Git command,

Source: Internet
Author: User

Git command,
Git config -- global user. name "xxx" # configure the username git config -- global user. email "xxx@xxx.com" # configure the mail git config -- global color. ui true # git status and other commands automatically color git config -- global color. status autogit config -- global color. diff autogit config -- global color. branch autogit config -- global color. interactive autogit config -- global -- unset http. proxy # remove proxy configuration on gitgit clone git + ssh: // git@192.1 68.53.168/VT. git # clone remote repository git status # view the current version status (whether to modify) git add xyz # add the xyz file to indexgit add. # add all changed files in the current subdirectory to indexgit commit-m 'xxx' # submit git commit -- amend-m 'xxx' # merge the previous commit (used for repeated modification) git commit-am 'xxx' # combine add and commit into git rm xxx # delete the file git rm-r in the index * # recursively Delete git log # display commit log git log-1 #1 line of log display-n is n lines of git log-5git log -- stat # displays the commit log and related change files git log-p-mgit show dfb02e6e4f2f7b573337763e5c001380 2e392818 # display the details of a submission git show dfb02 # only the first few git show heads of commitid can be used # display the HEAD commit log git show HEAD ^ # display the parent of the HEAD (Previous Version) commit log ^ for the previous two versions ^ 5 for the previous five versions git tag # show the existing taggit tag-a v2.0-m 'xxx' # Add the taggit show v2.0 # display v2.0 logs and details git log v2.0 # display v2.0 logs git diff # display all changes not added to the index git diff -- cached # Show All added indexes but not commit git diff HEAD ^ # Comparison with the previous version git diff HEAD --. /lib # compare the differences between the lib directory and the HEAD version. git diff origi N/master .. master # Compare the git diff origin/master not available on the master of the local branch on the master of the remote branch .. master -- stat # only show the difference file, do not show the specific content git remote add origin git + ssh: // git@192.168.53.168/VT. git # add remote definition (for push/pull/fetch) git branch # display local branch git branch -- contains 50089 # display branch git branch containing commit 50089-a # Show All branches git branch-r # Show all original branches git branch -- merged # show all branches that have been merged to the current branch git branch -- no-merged # Show All branches that have not been merged to the current branch git branch-m master maste R_copy # rename the local branch git checkout-B master_copy # create a new branch master_copy from the current branch and check out git checkout-B master master_copy # The above full version git checkout features/performance # Check out the existing features/performance branch git checkout -- track hotfixes/BJVEP933 # Check remote branch hotfixes/BJVEP933 and create local tracking branch git checkout v2.0 # Check out version v2.0git checkout-B devel origin/develop # from remote branch develop creates a new local branch devel and detects git checkout -- README # detects the README file of the head version (which can be used to modify the error rollback) git Merge origin/master # merge the remote master branch to the current branch git cherry-pick ff44785404a8e # merge and submit the modification of ff44785404a8e git push origin master # push the current branch to the remote master branch git push origin: hotfixes/BJVEP933 # Delete hotfixes/BJVEP933 branch git push -- tags # push all tags to the remote repository git fetch # Get all remote branches (merge is required if the local branch is not updated) git fetch -- prune # Get all original branches and clear the removed branches on the server git pull origin master # Get the remote branch master and merge to the current branch git mv README README2 # rename the file README README2g It reset -- hard HEAD # reset the current version to HEAD (usually used for merge failure rollback) git rebasegit branch-d hotfixes/BJVEP933 # Delete branch hotfixes/BJVEP933 (the modifications to this branch have been merged to other branches) git branch-D hotfixes/BJVEP933 # force Delete branch hotfixes/BJVEP933git ls-files # list git index files git show-branch # The current branch history git show-branch -- all # figure git whatchanged for all branch history # git revert modification corresponding to the submission history # undo commit dfb02e6e4f2f7b573337763e5c0013802e3 92818git ls-tree HEAD # Internal Command: display a git object git rev-parse v2.0 # Internal Command: Display SHA1 HASHgit reflog for a ref # Show All commits, including the isolated node git show HEAD @ {5} git show master @ {yesterday} # display the status git log of the master branch yesterday -- pretty = format: '% h % s' -- graph # submit the log git show HEAD ~ 3git show-s -- pretty = raw 2be7fcb476git stash # Save the current modification, put all git stash lists in the HEAD state # view all temporary git stash show-p stash @ {0} # refer to the first temporary git stash apply stash @ {0} # The first temporary git grep for the Application "delete from" # search for the text "delete from" git grep-e '# define' -- and-e sort_dimo-git gc in the file

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: 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

  • 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.