Common Git commands and git commands

Source: Internet
Author: User
Tags git commands

Common Git commands and git commands

This article is in the study of the summary, welcome to reprint but please note the Source: http://blog.csdn.net/pistolove/article/details/47315569



Recently, I have been studying common git commands and basic operations. The following describes some websites and common git commands for beginners. I hope they can help you.

Git beginner reference Learning Website:

Http://www.admin10000.com/document/5374.html git usage tutorial

Introduction to http://www.oschina.net/question/565065_68194 git

Common git operations for http://www.cnblogs.com/wang_yb/p/3867221.html

Git often uses the following commands:
Git init Initialization
Git branch: view all local branches
Git status to view the current status
Git commit submit
Git branch-a view all branches
Git branch-r view all remote branches
Git commit-am "init" Submit and add comments
Git remote add origin git@192.168.1.119: ndshow
Git push origin master to push the file to the server
Git remote show origin displays Resources in the remote library origin
Git push origin master: develop
Git push origin master: hb-dev associate the local database with the database on the server
Git checkout -- track origin/dev switch to remote dev Branch
Git branch-D master develop Delete local database develop
Git checkout-B dev creates a new local branch dev
Git merge origin/dev combines the dev branch with the current Branch
Switch git checkout dev to the local dev Branch
Git remote show to view remote Libraries
Git add. add the directory of the previous directory
Git rm file name (including path) delete specified file from git
Git clone git: // github.com/xxx/xxx.git pull the code down from the server
Git config -- list to view all users
Git ls-files to view submitted
Git rm [file name] delete an object
Git commit-a submits all changes to the current repos
Git add [file name] add a file to git index
Git commit-v: when you use the-v parameter, you can see the difference between commit.
Git commit-m "This is the message describing the commit" add commit Information
Git commit-a indicates add. add all the changes to the git index and then commit.
Git commit-a-v General commit command
Git log to view your commit log
Git log-p-2 common-p option to show differences in each submitted content, use-2 to show only the last two updates
Git reset -- hard load an old record and delete all new records.
View unsaved updates in git diff
Git rm a. a. Remove files (from the temporary storage zone and workspace)
Git rm -- cached a. a: Remove files (only deleted from the temporary storage zone)
Git commit-m "remove" remove files (delete from Git)
Git rm-f a. a forcibly remove the modified file (deleted from the temporary storage zone and workspace)
Git diff -- cached or $ git diff -- staged to view uncommitted updates
Git stash push pushes files to a temporary space
Git stash pop: pop the file from the temporary space
Git remote add origin git@github.com: username/Hello-World.git
Git push origin master to submit local project to server
Local synchronization between git pull and Server
Git push (Remote repository name) pushes local branches to the server.
Git push origin master submit to remote Branch
Git fetch is equivalent to obtaining the latest version from a remote device to the local device, and does not automatically merge
Git commit-a-m "log_message" (-a is to submit all changes,-m is to add log information) Local modifications are synchronized to the server:
Git branch branch_0.1 master creates branch_0.1 branch from master
Git branch-m branch_0.1 branch_1.0 rename branch_0.1 to branch_1.0
Git checkout branch_1.0/master switch to branch_1.0/master Branch
Git branch delete remote branch
Git push origin: branch_remote_name
Git branch-r-d branch_remote_name
Rm B .txt Delete B. If you want to delete it completely, use commit. If you want to return it, use git checkout --b.txt.
Cat demo.txt view the content of the current file
Git reset -- hard version
Git reflog gets the version number
Git reset -- hard HEAD ^ version rollback. If you want to roll back to the previous version, you only need to change HEAD ^ to HEAD ^ and so on;
Git reset-hard HEAD ~ 100 to roll back to the first 100 versions
Git log -- pretty = oneline displays the log information as a row
Git config-l view your Git global settings
Gitk uses graphical tools to view submission history

Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.

Related Article

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.