Home > Article > Development Tools > Completely master the git visual commit tool Sourcetree
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.
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
Directly on the official website Just download and install it. It is a free tool software.
https://www.sourcetreeapp.com/
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.
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 }]
(2) Restart and enter the page smoothly, as shown in the figure:
sourcetree is a free Git client. How to use it to pull code from gitlab? The steps are as follows:
The command is: ssh-keygen -t rsa, as shown in the figure:
The following picture appears, indicating that the public key is generated successfully!
The directory where the secret key is generated is in .ssh\id_rsa.pub in the user directory of your system disk
(binding operation: Settings --> SSH Keys --> Add key (open the local public key file and paste all the contents inside)), as shown in the figure:
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.
Click "Tools->Options->General" and pay attention to the settings of the following four parts, as shown in the figure:
Be sure to select Open ssh, confirm, and click Push again to realize the push function.
You can see the files you submitted on GitHub.
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)
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
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!