git command Reference manual (text version)

Source: Internet
Author: User
Tags sha1 hash

GIT init # Initialize the local git repository (create a new warehouse)
git config--global user.name "xxx" # Configure user Name
git config--global user.email "[email protected]" # Configure mail
git config--global color.ui true # git status and other commands auto-coloring
git config--global color.status auto
git config--global color.diff auto
git config--global color.branch auto
git config--global color.interactive auto
git clone git+ssh://[email protected]/vt.git # clone remote Repository
Git status # View current version status (modified)
git add xyz # Add xyz file to index
git Add. # Add all the changed files to index in the current sub-directory
git commit-m ' xxx ' # submit
git commit--amend-m ' xxx ' # merge last commit (for repeated changes)
git commit-am ' xxx ' # adds add and commit as one step
git rm xxx # delete files in index
Git rm-r * # recursive delete
Git log # Displays the commit log
Git log-1 # shows 1 rows of log-N for rows
Git log-5
git log--stat # Displays the commit log and related changes file
Git log-p-M
Git show dfb02e6e4f2f7b573337763e5c0013802e392818 # shows the details of a commit
Git show DFB02 # can only use the first few Commitid
Git show Head # show head commit log
Git show head^ # shows the parent of the HEAD (previous version) of the commit log ^^ to 5 versions on the previous two versions ^5
git tag # shows the existing tag
git tag-a v2.0-m ' xxx ' # Add v2.0 tag
Git Show v2.0 # shows V2.0 's log and details
git log v2.0 # Displays the v2.0 log
Git diff # shows all changes not added to index
git diff--cached # shows all changes that have been added to the index but have not yet been commit
git diff head^ # compare to previous version differences
git diff head--./lib # Comparison vs. Head version lib directory differences
Git diff origin/master. Master # Compare Remote Branch master with local branch not on master
Git diff origin/master. Master--stat # displays only the diff files, not the specific content
Git remote add Origin git+ssh://[email protected]/vt.git # Add remoting definition (for Push/pull/fetch)
Git Branch # Show local Branch
Git branch--contains 50089 # shows the branch that contains commit 50089
Git branch-a # Show all Branches
Git branch-r # Show all original branches
Git branch--merged # shows all the branches that have been merged into the current branch
Git branch--no-merged # shows all branches that are not merged into the current branch
git branch-m Master master_copy # Local branch renamed
Git checkout-b master_copy # Creates a new branch from the current branch master_copy and checks out
git checkout-b Master Master_copy # The full version above
git checkout features/performance # Check out an existing Features/performance branch
git checkout--track hotfixes/bjvep933 # Check out remote branch hotfixes/bjvep933 and create local trace branch
Git Checkout v2.0 # Check out version v2.0
git checkout-b devel origin/develop # Create new local branch devel from remote branch develop and check out
Git checkout--Readme # Check out the head version of the Readme file (can be used to modify the error fallback)
git merge Origin/master # merge remote Master branch to current branch
git cherry-pick ff44785404a8e # Merge Commit ff44785404a8e changes
Git push Origin Master # push the current branch to the remote master branch
git push origin:hotfixes/bjvep933 # Delete hotfixes/bjvep933 branch of remote repository
git push--tags # pushes all tags to the remote repository
git fetch # get all remote branches (do not update local branch and merge required)
git fetch--prune # get all the original branches and clear the deleted branches on the server
Git pull Origin Master # get remote Branch Master and merge to current branch
git mv Readme README2 # Rename file Readme to README2
git reset--hard Head # Resets the current version to head (typically used for merge fail fallback)
Git rebase
git branch-d hotfixes/bjvep933 # Delete Branch hotfixes/bjvep933 (this branch modification has been merged into another branch)
git branch-d hotfixes/bjvep933 # force Delete branch hotfixes/bjvep933
Git ls-files # Lists the files that git index contains
Git show-branch # Diagram Current Branch history
git show-branch--all # Diagram of all branch history
Git whatchanged # show file changes for commit history
git revert dfb02e6e4f2f7b573337763e5c0013802e392818 # Undo Commit dfb02e6e4f2f7b573337763e5c0013802e392818
git ls-tree HEAD # internal command: show a Git object
Git rev-parse v2.0 # Internal command: Displays the SHA1 HASH for a ref
Git Reflog # shows all commits, including orphaned nodes
git show [email protected]{5}
git show [email protected]{yesterday} # shows the status of the Master branch yesterday
git log--pretty=format: '%h%s '--graph # Diagram commit Log
Git show head~3
git show-s--pretty=raw 2be7fcb476
Git Stash # Staging current changes, all to the head state
git Stash List # view all staging
git stash show-p [email protected]{0} # Reference for first time staging
git stash apply [email protected]{0} # Apply first time staging
git grep "Delete from" # File search text "delete from"
git grep-e ' #define '--and-e sort_dirent
Git GC
Git fsck

git command Reference manual (text version)

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.