Github&&sourcetree Tutorials

Source: Internet
Author: User
Tags git workflow git client sourcetree

--This tutorial is for the mainstream open source Web site GitHub and BitBucket, who personally think that Sourcetree is still a good git client that supports Windows and Mac OS.

The latest version of-->sourecetree may be slightly different from the screenshot of this tutorial, but much the same (more user-friendly on the latest version of Sourcetree)

-You can first look at a git workflow video, first understand, was Youku transcoding, not very clear, will see it, point here

--Register an account on GitHub and log in.

Click on GitHub to create new, new repository, just type in a project name, and pay attention to the Init this repository with the Readme (not selected or, afterwards, edit yourself later), such as.

For the GIT process, give a good reference link, click I open

--If you want to delete the item you just created, you can, point to the bottom right corner of the setting, for example.

--Pull the page to the bottom, click Delete this repository, enter the project name in the popup layer, click Delete, such as.

--Now to clone a remote project locally, click on GitHub on the project you just created, do the project details, in the lower right corner there is a piece of information, copy the HTTPS connection, as

--In a local directory, enter the following command, Git clone, (here is a my open source project as an example),

And we can see that the new project in addition to a readme file, nothing, you can randomly copy the contents of a MAVEN project into this directory, compiled correctly, you can submit, below we take sourcetree as an example, To demonstrate how to submit changes with visual GUI tools.

--Download and install Sourcetree, take the Windows version as an example, after the installation is complete, open sourcetree, as

--click File-open, select the root directory of the project we just clone out, after opening, as you can see, branches only a master, click on the right uncommited changes, will show you all the changed but not submitted files.

--Look at unstaged files this piece of content, we hold down SHIFT, select all the files you want to submit, then click the right mouse button, select Add (meaning add to the local index library), after the operation is completed, staged Files This content will appear all the documents we just selected, such as

And before we commit to the local repo, we first set up a generic information in the Sourcetree, and when commit is local, this infomation will be used as a generic commit message, click on Tool->options, Enter your GitHub account information in full name and email address, as

--back to the point we just made, after selecting the file to submit to the local repository in staged files, click on the commit in the upper left corner of Sourcetree, and then let us enter comments about the This commit, input, click Submit, You may be prompted to enter a user name and password for GitHub, such as

So far, we just submitted to the local repository, the final step is to submit to the remote repository, click on the toolbar push button, you can submit to the remote repository (push to remote, it is best to start from remote pull). Click Pull to download the latest changes from the remote repository, such as

When you click on Push, you will be asked to choose which branch of the remote repository you want to commit to, and after committing to the remote repository, you can see what you have submitted on GitHub, such as

The modifications on branch 1 can be changed directly to branch 2 via cherry pick.

You can also go through the merge operation at branch 2 to get the commit of the other branches, but merge by IntelliJ idea.

Note that cherry pick only uses the code that is directly taken to your submission, and the submission will not be made until you submit it, and the merge will also bring you in before the submission of the other person.

IntelliJ IDE operations such as:

-->sourcetree the left column of the branches, you can easily delete, and then re-select from the remotes you want to check out the branch, clone to the local repository.

-For all current local changes, you can use the STASH function to temporarily save the changes, at any time can apply stash to the current work branch.

--so far, the use of Githut and Sourcetree, the end of the tool is only convenient for the masses, do not exclude only command line operation, Play it yourself ...

Github&&sourcetree Tutorials

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.