Go git command Reference manual (text version)

Source: Internet
Author: User

git init # initialize the local git repository (create a new repository) git config--global User.Name"XXX"# Configure user name git config--global User.email"[email protected]"# configure mail git config--global Color.uitrue# git status and other commands automatically coloring git config--global color.status autogit config--global color.diffautogit config--global Color.branch autogit config--Global color.interactive autogit clone git+SSH://[Email protected]/vt.git # clone remote repositorygit status # View current version status (modified) git add xyz                                                 # Add XYZ file to indexgit Add. # Add all changed files under current subdirectory to Indexgit commit-M'XXX'# commit Git commit--amend-m'XXX'# Merge Last commit (for repeated changes) git commit+a+'XXX'# Combine add and commit as one-step gitRMXXX # Delete files in index gitRM-R *# recursive Delete git log # Displays the submission date Log git log-1# 1 rows of logs are displayed-n is n rows git log-5git log--Stat# Show commit log and related changes file git log-P-mgit Show dfb02e6e4f2f7b573337763e5c0013802e392818 # Show details of a commit git show dfb02 # can only use Commitid's first few git show Head # show head commit log git show head^ # Show the parent of Head (previous version) the commit log ^^ to two versions ^5 is the last 5 versions of Git tag # Show existing taggit tag-A v2.0-M'XXX'# Add v2.0 to Taggit Show V2.0# Displays v2.0 log and details git log v2.0# Show V2.0 's log gitdiff# Show all changes not added to index gitdiff--Cached # Shows all changes that have been added to the index but have not yet been commit gitdiffhead^# Compare the differences with the previous version of GitdiffHEAD--./Lib # Compare differences with the Head version lib directory gitdifforigin/Master.. Master # Compare Remote branch master with git not on the local branch masterdiffOrigin/master. Master--Stat# Show only the diff files, do not show specific content git remote add origin git+SSH://[Email protected]/vt.git # Add remote definition (for Push/pull/fetch)git Branch # show local branch git branch--contains50089# shows the branch git branch that contains commit 50089-A # Show all branches git branch-R # Show all original branch git branch--merged # shows all branches that have been merged into the current branch git branch--no-merged # shows all branches that have not been merged into the current branch git branch-m Master master_copy # Local branch renamed git checkout-B master_copy # Create a new branch from the current branch master_copy and check out git checkout-b Master Master_copy # above the full version of Git checkout features/performance # Checking out an existing features/Performance branch git checkout--track hotfixes/bjvep933 # Check out remote branch hotfixes/BJVEP933 and create a local trace branch git checkout v2.0# Check out version v2.0git checkout-B devel origin/Develop # Create a new local branch from a remote branch develop devel 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 modify Git push Origin master # Push the current branch to the remote master branch git push origin:hotfixes/bjvep933 # Remove hotfixes/from remote repositoriesBJVEP933 branch git push--Tags # push all tags to remote repository git fetch # Get all remote branches (do not update local branch and merge) 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 gitMVReadme README2 # Rename file readme for Readme2git reset--Hard HEAD # Resets the current version to HEAD (typically used for merge failure fallback) git rebasegit 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/Bjvep933gitls-Files # list git index contains file git show-Branch # Diagram Current branch history git show-branch--All # Diagram All branches history git whatchanged # Show commit history correspondence File modified git revert dfb02e6e4f2f7b573337763e5c0013802e392818 # Undo Commit Dfb02e6e4f2f7b573337763e5c0013802e392818gitls-Tree HEAD # Internal command: Display a Git object git rev-parse v2.0# Internal command: Displays a ref for the SHA1 hashgit Reflog # Show all commits, including orphaned nodes git show [email protected]{5}git Show [email protected]{yesterday} # show Master branch yesterday's state git log--pretty=format:'%h%s'--Graph # Diagram commit log git show HEAD~3git show-S--pretty=Raw 2be7fcb476git Stash # Temporary current modifications, all to the head state git stash list # view all staged git stash show-P [Email protected]{0} # Refer to the first staged git stash apply [email protected]{0} # Apply the first time you staged Gitgrep "Delete from"# File Search for text "delete from" Gitgrep-E'#define'--and-e sort_direntgit gcgit fsck

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