-- 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)
--Register an account on GitHub and log in.
Click on GitHub on the Create new, new repository, just enter a project name, pay attention to the Init this repository with the Readme (do not choose also can, after the later edit themselves), as shown below.
--If you want to delete the item you just created, you can, point to the bottom right corner of the setting, as shown below.
--Pull the page to the bottom, click Delete this repository, enter the project name in the popup layer, click Delete, as shown below.
--now in the local clone out remote project, on GitHub Click on the project you just created, to do project details, in the lower right corner there is a piece of information, copy the HTTPS connection, as shown below
--In a local directory, enter the following command, Git clone https://github.com/collonn/MyBatisGen.git, (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 shown below
-click File-open, select the root directory of the project we just clone out, after opening, as shown below, you can see that branches only a master, click on the right uncommited changes, All the files you have changed but not submitted will be displayed.
--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 piece of content will appear the file we have just selected, the following image
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 shown below
--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 the user name and password for GitHub as shown below
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 submitted by others from the remote repository, as shown below
By clicking on Push, you can choose which branch of the remote repository you want to commit to, and after committing to the remote repository, you'll see what you've submitted on GitHub, as shown below
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.
The IntelliJ IDE operates as shown in the following diagram:
-->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 ...