git command Daquan

Source: Internet
Author: User
Tags git commands

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 config--global--unset http.proxy # Remove proxy configuration on Gitgit 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 xxx # Delete in index                                                   File git rm-r * # recursive delete git log                                            # Show Commit log git log-1 # shows 1 rows of log-n for n-line git log-5git log--stat # Show commit log and related changes file Git log-p-mgit show dfb02e6e4f2f7b573337763e5c0013802e392818 # show A Commit                                             Git show DFB02 # can only use Commitid's first few git show HEAD # show head commit log git show head^ # shows the parent of Head (previous version) of the commit log ^^ for the last two versions ^5                                  5 versions of Git tag # Show existing taggit tag-a v2.0-m ' xxx '                                       # Add v2.0 taggit Show v2.0 # Show v2.0 log and details git log v2.0       # Show V2.0 's 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 the previous Version of the difference git diff HEAD--./lib # Comparison with the HEAD version of the Lib directory differs from Git diff origin/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 not merged into the current branchBranch 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/per  Formance # Checking 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 # Checkout 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 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-pi                                    CK ff44785404a8e # Merge Commit ff44785404a8e modify Git push Origin master # Push the current branch to the remote master branch git push origin:hotfixes/bjvep933 # delete hotfixes/bjvep933 branch git push for remote repository--                    Tags                       # Push all tags to remote repository git fetch # get all the remote branches (do not update the local branch and need the merge                                    git fetch--prune # gets all the original branches and clears the deleted branch from 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 failure fallback) git rebasegit branch-d hotfixes/bj                           VEP933 # 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 files git show-branc H # Diagram Current branch history git show-branch--all # diagram All branch history Git whatchanged # shows file commit history corresponding to modify git revert dfb02e6e4f2f7b573337763e5c0013802e3928 18 # Undo Commit Dfb02e6e4F2f7b573337763e5c0013802e392818git ls-tree HEAD # Internal command: Displays 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 first staged git grep "delete from" # File Search for text "delete from" git grep-e ' #define '--and-e sort_direntgit gcgit fsck

Git commands Daquan

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.