Git command quick reference (using git Appendix A) 1. initialize the global user name and email address gitconfig -- globaluser. name & quot; YourName & quot; gitconfig -- globaluser. email & quot; youe@example.com & quot; can be used for unused version libraries (Git command quick reference (use git Appendix A) 1. initialize the global user name and email address git config -- global user. name "Your Name" git config -- global user. email "youe@example.com" allows you to set a separate user name and email address cd/path/to/repogit config user for unused version libraries (projects. name "you name" git config user. email "you@example.com" uses different colors in the command line git config -- global color. ui "auto" initializes the new version Library mkdir/path/to/repocd/path/to/repogit initgit add. git commit-m "inner import" clone repository git clone Git clone repository/path/to/existing/directorygit initgit add. git commit-m "incision import of some projects." set the remote repository alias git remote add in the local repository 2. Daily git add operations Git commit-m" "Modify git add-p for saving part of an existing file [ [ [And so on] use interactive add file git add-I to save changes to files already under Git version control git add-u [ [ ] Submit the Git commit-m "some message"-a to modify the number of working directories under git version control. [ ] Cancel the temporary ID git reset HEAD that has been saved but not submitted [ ] Fixed the problem in the last commit and saved the file git commit-m "some message" -- amend to fix the problem in the last commit, git commit-c head -- amend 3. branch list local branch git branch list remote branch git branch-r list all branches git branch-a create new branch git branch based on current branch Check out git checkout of another branch Create a new branch based on the current branch and check the branch git checkout-B Create a new branch git branch based on another node Create a new branch with the same name to overwrite the existing branch git branch-f [Start point] move and rename the branch git checkout-m Merge another branch to the current branch git merge Git merge -- no-commit Pick and merge and submit git cherry-pick Select merge but not commit git cherry-pick-n Merge (compress and merge) the content on a dozen branches to another branch (previous commit) git merge -- squash Delete branch git branch-d Delete a branch, git branch-D, whether merged or not. 4. history show all history git log show version history and content difference between versions git log-p only show the last three committed git log-3 show the content difference between the last 20 commits and versions git log-20-p shows the submitted git log in the last 6 hours -- since = "6 hours" git log -- before = "2 days" show HEAD (the end of the branch currently detected) the one submitted three times earlier: git log-1 HEAD ~ 3git log-1 HEAD ^ or git log-1 HEAD ~ 1 ^ displays the commit git log between two versions Display History. each submission displays a row, git log -- pretty = oneline displays the name and status of the modified file. git log -- name-status displays the differences between the current working directory tree and the temporary storage interval. git diff Displays differences between the staging zone and version Library git diff -- cached displays the differences between the current working directory tree and a specific version in the version Library git diff HEAD displays the differences between the working directory and a submitted version in the version Library git diff Show differences between two versions in the version Library git diff Git diff -- stat Display the modifier of each part of the file and related commit information git blame And git blame-M Displays the modifications and related submission information of each part of the file, including the moving content between files. git blame-C-c When the history is displayed, the copy and paste information git log-C-c-p-1 is displayed. 5. clone remote version Library git clone Clone the remote version library, but only download the history record of the last 200 submitted git clone -- depth 200 Set the remote repository alias git remote add in the local repository Show remote branch git branch-r create local branch git branch based on remote branch Create local branch git branch based on remote tags The change is obtained from the remote version library of the alias Origin, but not merged to the local branch git fetch. The change is obtained from any remote version library, but not merged to the local branch git fetch. Modify changes from any remote version library and merge the changes to the local branch git pull detected currently. Modify the changes from the remote version library with the alias "Origin" and merge the changes to the current local branch git pull to push the changes from the local branch to the remote version Library git push : Push the modification changes from the local branch to the remote branch with the same name git push Push modification changes from new branch in ticket location to remote git push Push the modification changes to the remote git push of the local database whose alias is "Origin". delete the branch git push in the remote version Library. : Delete the git remote prune branch that does not exist in all remote versions in the local version Library. Delete the abbreviation of a remote version library in the local version Library and the git remote rm 6. connect Git and SVN to clone all the content of the SVN version Library git svn clone Clone the SVN version library with the standard structure (the master name is trunk and the rest are under the branches directory) git svn clone-s Clone a svn version library with a non-standard structure: git svn clone-T -B -T Clone a version of the SVN version library in the standard structure git svn clone-s-r 2321 clone the SVN version library with the standard structure, add the prefix git SVN clone-s -- prefix svn/to the branches in svn/ Obtain the updated content from the upstream SVN version Library, in the local GIT version Library, the local branch git svn rebase is basically changed to push the changes back to the upstream SVN version Library git svn dcommit to list all the commits pushed to the upstream SVN version Library git svn dcommit-n display svn history git svn log display svn modifier of each part of the file and related commit information git svn blame
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:
info-contact@alibabacloud.com
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