preface

After I entered the company, the first project version management tool I came into contact with was SVN. SVN, short for Subversion, is an open source version control system. Compared with RCS and CVS, it adopts branch management system and is designed to replace CVS. Now the company also uses SVN instead of Git for its projects. I use the cornerstone_v3.0.3 instead of the command line when using SVN. Git does everything you can with Git commands and has a visual interface. I usually hosted to the code cloud Demo is also used to manage this software, the following start to introduce the installation and use of Sourcetree.

Introduce the content

directory

I. Introduction to Sourcetree
Download and install
Three, Sourcetree use
4. Solve common problems

A,SourcetreeIntroduction to the

A free Git client for Windows and Mac

Sourcetree simplifies how you interact with your Git repositories so you can focus on coding. Visualize and manage your repositories through Sourcetree’s simple Git GUI.

Sourcetree simplifies your interaction with Git repositories so you can focus on coding. Visualize and manage your repository with Sourcetree’s simple Git GUI.

Download and install

Sourcetree has MAC versions and Windows versions. Here, take the MAC version as an example.

1, download

  • Download the latest version of the official website
  • 6.3 Sourcetree_2.

2, installation,

  • 2.1 sourcetree_2.6.3 a. Zip After decompressing the file, double-click the sourcetree. app file to install itAtlassianI have already registered my account. Here I choose to use my existing account, as shown in the picture below:
  • 2.2 Configuring an Account you can skip the Settings or configure a GitHub account and password here. As shown below:
  • 2.3 After the installation, the interface is as follows:

Pay attention to

I chose to use SSH instead of HTTPS. Therefore, you need to configure the SSH key on the MAC. You can refer to this article to configure Git installation on the MAC and basic use of GitHub.

Three, Sourcetree use

1. First, set up a GitHub account

Because I have already configured it during installation, my GitHub account is in the account list, as shown in the picture below:

Set up the
preferences
add

2. Clone the remote warehouse to the local warehouse

This is if you have already created projects on your GitHub account.

  • 2.1 Clone the remote repository on the GUI client, configure the account, and clickThe distalThe GitHub TAB displays a list of projects on your GitHub account, as shown below:

    Here I clone the LearnGit project and select clone on the desktopGitUnder folder (if you want the local folder name to be the same as the project name, inGitAfter adding/LearnGitClick Clone, it will be created automaticallyLearnGitFolder), as shown below:

    After the clone is successfully cloned, the local repository will add this tag:

  • 2.2 Clone to the local repository using SSH Link. First copy the SSH address on GitHub, as shown in the following figure:

    And then clicknew->Clone from a remote URL, paste the address and set the storage path, as shown in the picture below:

    At this point, the remote project has been successfully cloned locally

3. Upload the local warehouse to the remote warehouse

  • 3.1 double clicklocal->The labelOr right mouse buttonOpen theThe details of the warehouse are as follows:

    The details are shown below. I have marked some commonly used plates, as shown below:

  • 3.2 openLearnGitDemo, add the code, and then view the warehouse details as shown below:
  • 3.3 Submit files in temporary storage area to local warehouse, as shown below:
  • 3.4 Click the push button to push the local warehouse to the remote end, as shown below:

    GitHub has the following submission information:

  • 3.5 Pull the latest update content of the remote warehouse. If there is an update of the remote warehouse, there will be a prompt of digital corner marks, as shown in the picture below:

    At this point, we have covered pushing the local repository to the remote and pulling the remote repository to the local repository.

  • Note that when committing local staging files to the remote end, it is best to pull the latest remote repository to avoid conflicts.

4. Sourcetree labeling

Git tagging on MAC introduces the use of command tagging operations, Sourcetree also supports tagging operations, and is visual, easy to operate.

  • 4.1 Sourcetree Creating a label

    Right mouse button selectionThe new label, as shown in the figure below:

    Check whether GitHub is successful:

    View the label information, as shown in the following figure:

  • 4.2 Deleting labels

    Before deleting the tagv1.0.2To delete all remote tags, both local and remote tags will be deleted. After deletion, go to GitHub to check, as shown in the picture below:

    The basic tagging operations are covered here.

5. Branch

  • 5.1 Creating a Branch, as shown in the following figure:

    Once created, the local branch has an develop branch, as shown in the figure below:

  • 5.2 Submit changes to the local warehouse, as shown below:
  • 5.3 Under the Develop branch, push the changes to the remote end, as shown in the following figure:
  • 5.4 Merging Branches: First, switch to the branch to be mergedmaster, as shown in the figure below:

    developBranch submissions are merged intomasterBranch, as shown in the figure below:

    After the merge, you need to commit the changes to the remote end, as shown below:

    Check whether the branches are merged successfully on GitHub, as shown in the following figure:

4. Solve common problems

1. The size of the uploaded file exceeds the upper limit and cannot be uploaded

  • In 1.1 Terminal, open terminal input (global configuration: 500 MB) :
git config http.postBuffer 524288000
Copy the code

Postbuffer =524288000 postbuffer=524288000

git config -l
Copy the code
  • Git git git git git git git git git
[http]
	postBuffer = 524288000
Copy the code

  • 1.3 Submit large files via Git extension **git-lfs** (Git extension for versioning Large Files).
/usr/bin/ruby-e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"4. Select the type of Git LFS file you want to manage (or edit. Gitattributes) track"*.zip"Git add. Gitattributes // commit to git add file.psd git commit  -m"Add design file"
git push origin master

Copy the code

Git Large File Storage

2,warning: templates not found /usr/local/git/share/git-core/templates

You can run the open /usr/local/git command to check whether a file has been created.

yanjiyoudeMac-mini:~ admin$ open /usr/local/git
The file /usr/local/git does not exist.
Copy the code

If not created, create:

// Create git folder sudo mkdir /usr/localSudo mkdir /usr/local/git/share // create git-core directory sudo mkdir /usr/local/git/share/git-core // create a templates folder sudo mkdir /usr/local/git/share/git-core/templates // create templates folder sudo chmod -r 755 /usr/local/git/share/git-core/templates
Copy the code

After the creation is complete, clone again to local clone.

conclusion

This article also only recorded some basic operations of Sourcetree. The company’s current project is not managed by Git, and I am using Git mainly to host my own tool demo. I don’t know how I got access to this software. So I asked my colleague how to climb over the wall, and successfully installed this software after climbing over the wall. Some of these use methods, but also their own slowly grope, may also have wrong places, please understand. By writing this article, I found myself on the Git concepts is not very understanding, for some common commands is not very familiar with, the article also didn’t talk about Git workflow, it seems you really need to fill the Git command of relevant knowledge, whether using Git commands or GUI, is more practical, more memorable. In future work, if there are more practical applications or problems encountered in the process of use, I will also supplement them in this article. Interested friends can download and install their own use!

Refer to the article

  • GitHub and SourceTree tutorials
  • SourceTree is a github management tool
  • SourceTree harder to use
  • Use of SourceTree in Mac (2016 latest)
  • Foundation for GUI for git | SourceTree |
  • Git Flow model based on SourceTree
  • Smart branching with SourceTree and Git-flow