Collection of common git operation commands

Source: Internet
Author: User

Recently, I used git for version control. I found that git has many commands, so I can write down some common commands for viewing. The following content is a summary of this article, which is quite good. Let's take a look.

Certificate ------------------------------------------------------------------------------------------------------------------------------------------

1) remote warehouse commands

Check out Repository: $ git clone git: // github.com/jquery/jquery.git

View remote Repository: $ git remote-V add remote Repository: $ git remote add [name] [url] Delete remote Repository: $ git remote RM [name] Pull remote Repository: $ git pull [remotename] [localbranchname] Push remote Repository: $ git push [remotename] [localbranchname] 2) branch operation commandsView local branch: $ git branch view remote branch: $ git branch-r create local branch: $ git branch [name] ---- note that after the new branch is created, it will not automatically switch to the current Branch: $ git checkout [name] Create a new branch and immediately switch to the new branch: $ git checkout-B [name] Delete the branch: the $ git branch-d [name] -----D option can only delete the branches that have already been merged. To forcibly delete a branch, use the-D option to merge the branch: $ git merge [name] ---- merge the branch named [name] with the current branch to create a remote Branch (push local branch to remote ): $ git push origin [name] Delete remote branch: $ git push origin: heads/[name] 3) version (TAG) related commandsView version: $ git tag created version: $ git tag [name] Delete version: $ git tag-d [name] view remote version: $ git tag-r create remote version (local version push to remote): $ git push origin [name] Delete remote version: $ git push origin: refs/tags/[name] 4) submodule related operation commandsAdd sub-module: $ git submodule add [url] [path] initialize sub-module: $ git submodule init ---- update the sub-module only once when the first warehouse is detected: $ git submodule update ---- run the following command to delete the sub-module after each update or switch branch: $ git Rm -- cached [path] 5) Ignore some files and folders and do not submit them.Create a file named ". gitignore" in the root directory of the repository and write the folder name or file that is not required. Each element occupies one row, for example, targetbin *. DB.

This article from: http://hi.baidu.com/hk2305621/blog/item/fe23cc864685ca34c75cc3a3.html

Certificate ------------------------------------------------------------------------------------------------------------------------------------------

For more information, see:

Http://blog.163.com/evan__zhang@yeah/blog/static/12103275720096204235185/

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.