GIT version Control Common Command summary

Source: Internet
Author: User

[Transfer from]:http://www.cnblogs.com/sawyerzhu/p/3578268.html

GIT version Control Common Command summary

Git version view current git release information

git help gets all command assistance information

git help <command> get specific command assistance information

git config user.name "Your name Comes here" to set the current project git user name

git config--global user.name "Your name Comes here" set global project git user name

git config user.email [email protected] Set current project git email

git config--global user.email [email protected] SET global project git email

git config--list displays the current project settings parameters

git config--global--list display global project Settings parameters

Git init initializes the GIT repository

git add <fileName1> <fileName2> ... Add specified file to index

Git add <folderPath> Add specified directory to index

git Add. Add all files in the Git directory to the index

Git add--all Add all files to index

git rm <folderPath/fileName> Delete specified file

Git Status View current local library status

git commit-m "commit message" commits changes to the current working directory, using GIT status to view the current branch status before use

git log Print history log

Git reset-hard <branchName/tag/commitID> Returns the specified commit state, including the local file

Git reset-soft <branchName/tag/commitID> Returns the specified commit state, excluding local files

Git branch view now local branch situation

git branch-r View server-side branching

Git branch <branchName> create a new branch named Branchname

git branch-d <branchName> delete an old branch named Branchname

Git branch-m <oldBranchName> <newBranchName> Change the name of the branch named Oldbranchname to Newbranchname

git branch-m <newBranchName> Change the working branch name to Newbranchname

git checkout <localBranchName> switch to the local branch named Localbranchname

git checkout <remoteBranchName> switches to a remote branch named Remotebranchname, where you don't create a new branch, but you're on a temporary branch called No branch, and you need to use Git branch-b To create a new branch and attach the temporary branch to the new branch

Git checkout-b <branchName> Create a new branch named Branchname and switch to that branch

Git merge <branchName> merge a branch named Branchname into the branch you're currently on

Git pull gets the code from the server's warehouse and merges with the local code

git push pushes local code to the server's repository

Git push-f forces local code to be pushed to the server's repository to push local index and server index to a conflicting branch

Git push origin--delete <branchName> Delete remote branch named Branchname

git clone <userName>@<serviceAddress>:<serviceProjectDirectory/projectName> < localprojectdirectory>/cloning a project from the server side to a local

GIT version Control Common Command summary

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.