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.u I true # git status and other commands automatically coloring git config--global color.status autogit config--global color.diff Auto git config--global color.branch autogit config--global color.interactive autogit clone git+ssh://[email protected ]/vt.git # clone remote repository git status # View current version status (modified) git add xyz # Add XYZ file to indexgit Add. # Add the current subdirectory of all changed files to indexgit commit-m ' xxx ' # commit git commit--amend-m ' xxx ' # Merge Last commit (for repeated changes) git commit-am ' xxx ' # Add and commit as one step git rm x Xx # Delete files in index git rm-r * # recursively delete git log # Show Commit log git log-1 # shows 1 rows of log-n for n-line git log-5gi T Log--stat # Show commit log and related changes file Git log-p-mgit show dfb02e6e4f2f7b573337763e5c001 3802e392818 # 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 head The parent (previous version) of the commit log ^^ for the last two versions of ^5 for the last 5 versions of Git tag # Show existing Taggit tag-a v2.0-m ' x XX ' # Add v2.0 taggit Show v2.0 # Show v2.0 log and detail inside tolerant git log v2.0 # shows v2.0 's Log git diff # Show all changes not added to indexgit diff--cached # shows all changes that have been added to the index but have not yet been commit git diff head^ # Compare the differences with the previous version of Git diff HEAD--./lib # Compare the differences with the head version lib directory git diff ori Gin/master. Master # Compare the remote branch master with a git diff origin/master that is not on the local branch master. Master--stat # displays only the diff files, does not display the specific content git remote add Origin git+ssh://[email protected]/vt.git # Add remotely defined (for Push/pull/fetch) Git branch # show local branch git branch--contains 50089 # show Git branch-a # that contains the branch of Commit 50089 # Show all branches git branch-r # Show all original branches git branch--merged # Show all merged into the current branch Branching 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 the git checkout-b Master master_copy # above Full version git checkout features/performance # Check out the existing features/performance branch git checkout--track hotfixes/b JVEP933 # Check out remote branch hotfixes/bjvep933 and create local trace branch git checkout v2.0 # Check Out version v2.0git checkout-b devel origin/develop # Create a new local branch develop from the remote branch 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 # Delete the remote repository's Ho tfixes/bjvep933 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 branch of the server git pull ori Gin Master # Get remote Branch Master and merge to current branch git MV README README2 # Rename file Readme to readme2git Reset--hard Head # Resets the current version to head (typically used for merge failed fallback) Git Reb Asegit 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/bjvep933git ls-files # List Git index contains the file git show-branch # Diagram Current branch history git show-branch--all # Diagram of all branching history git whatchanged # shows the commit history corresponding to the file modified git revert dfb02e6e4f 2f7b573337763e5c0013802e392818 # Undo Submit Dfb02e6e4f2f7b573337763e5c0013802e392818git Ls-tree HEAD # Internal LifeMake: Display a Git object git rev-parse v2.0 # Internal command: Displays a ref for 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 modification, all to head state GI T 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 git grep "dele Te from "# Files search for text" delete from "git grep-e ' #define '--and-e sort_direntgit gcgit fsck
Git command text manual