Home > Development Tools > git > body text

Completely master the git visual commit tool Sourcetree

WBOY
Release: 2022-02-09 18:10:31
forward
3647 people have browsed it

This article brings you relevant knowledge about Sourcetree, the git visual submission tool. Sourcetree is a free Git client for Windows and Mac. I hope it will be helpful to everyone.

Completely master the git visual commit tool Sourcetree

Basic usage of Sourcetree:

1. Introduction

A free Git client for Windows and Mac.

Sourcetree simplifies how to interact with Git repositories so you can focus on writing code. Visualize and manage repositories with Sourcetree's simple Git GUI.

Official website download address: Sourcetree | Free Git GUI for Mac and Windows

2. How to use:

1. Install the software:

Directly on the official website Just download and install it. It is a free tool software.

https://www.sourcetreeapp.com/
Copy after login

Completely master the git visual commit tool Sourcetree
After the download is completed, you need to log in through your account during the installation of SourceTree, but the registration or login interface may not work at all. It cannot be opened, causing the software to fail to install normally.
Solution:
(1) Create the file accounts.json under the directory C:\Users{yourname}\AppData\Local\Atlassian. Note: {yourname} needs to be replaced with the login system username.
For example, my computer path is: C:\Users\Kelly\AppData\Local\Atlassian.
Completely master the git visual commit tool Sourcetree
Write the following content:

[
  {
    "$id": "1",
    "$type": "SourceTree.Api.Host.Identity.Model.IdentityAccount, SourceTree.Api.Host.Identity",
    "Authenticate": true,
    "HostInstance": {
      "$id": "2",
      "$type": "SourceTree.Host.Atlassianaccount.AtlassianAccountInstance, SourceTree.Host.AtlassianAccount",
      "Host": {
        "$id": "3",
        "$type": "SourceTree.Host.Atlassianaccount.AtlassianAccountHost, SourceTree.Host.AtlassianAccount",
        "Id": "atlassian account"
      },
      "BaseUrl": "https://id.atlassian.com/"
    },
    "Credentials": {
      "$id": "4",
      "$type": "SourceTree.Model.BasicAuthCredentials, SourceTree.Api.Account",
      "Username": "username@email.com"
    },
    "IsDefault": false
  }]
Copy after login

(2) Restart and enter the page smoothly, as shown in the figure:
Completely master the git visual commit tool Sourcetree

2. Pull Code

sourcetree is a free Git client. How to use it to pull code from gitlab? The steps are as follows:

(1) Download and install git

(2) Run git and generate the secret key

The command is: ssh-keygen -t rsa, as shown in the figure:
Completely master the git visual commit tool Sourcetree
The following picture appears, indicating that the public key is generated successfully!
Completely master the git visual commit tool Sourcetree

The directory where the secret key is generated is in .ssh\id_rsa.pub in the user directory of your system disk
Completely master the git visual commit tool Sourcetree

(3) In your own git Bind your own git public key on the server

(binding operation: Settings --> SSH Keys --> Add key (open the local public key file and paste all the contents inside)), as shown in the figure:

Completely master the git visual commit tool Sourcetree

At this time, if we directly click "pull" or "push" the code in sourcetree, the following error will occur, so it needs to be configured in Sourcetree.
Completely master the git visual commit tool Sourcetree

(4) Use sourcetree to pull the code

Click "Tools->Options->General" and pay attention to the settings of the following four parts, as shown in the figure:
Completely master the git visual commit tool Sourcetree
Be sure to select Open ssh, confirm, and click Push again to realize the push function.
Completely master the git visual commit tool Sourcetree
You can see the files you submitted on GitHub.

(5) Tips: Pull first and then push

Completely master the git visual commit tool Sourcetree
If the number is displayed on the upper right corner of the pull when pushing, you need to pull first and then push. (If others remotely have submitted new code, there will be a mark on the "Pull" button that others have submitted)

3. Explanation of some terms of SourceTree&Git

  • Clone ( clone): Load from the remote warehouse URL to create a local warehouse that is the same as the remote warehouse

  • Commit (commit): Upload the temporary file to the local warehouse (we upload the local warehouse in Finder After making changes, you generally have to submit them once and then push them)

  • Checkout: switch to different branches

  • Add (add) :Add files to the cache area

  • Remove(remove): Remove files to the cache area

  • Temporary storage(git stash): Save Work site

  • Reset: Return to the most recent add/commit state

  • Merge: Merge multiple files with the same name into one file, which contains all the contents of multiple files with the same name, and the same content offsets

  • Fetch: Get information from the remote warehouse and synchronize to Local warehouse

  • Pull: Obtain information from the remote warehouse and synchronize it to the local warehouse, and automatically perform the merge operation, that is, pull=fetch merge

  • Push: Synchronize the local warehouse to the remote warehouse. Generally, pull once before pushing to ensure consistency.

  • Branch: Create/ Modify/delete branches

  • Tag: Add tags to the project

  • ## Workflow (Git Flow): When the team is working, each Individuals create their own branches and submit them to the master branch after confirmation.

  • Terminal: You can enter the git command line

Recommended learning: "

Git Tutorial"

The above is the detailed content of Completely master the git visual commit tool Sourcetree. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
git
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!