Git common commands and detailed explanation

1. The difference between git and SVN :

Let me talk about my own understanding. Git is a distributed version management system. Each PC is an independent and complete version library. The loss of a human project will not cause much impact. You only need to download it remotely, as long as you submit it to the remote , Everyone can view and update, every submission will have a record, high security, suitable for multi-person collaborative maintenance on the Internet, even without a network, individuals can edit, the operation on linux is more convenient; svn is Centralized, with higher network requirements, generally applicable to local area networks. For example, in the same office area of ​​a company, every submission of everyone is concentrated on the central server. Because it is a local area network, the speed is higher and the disadvantages are also obvious. The server is scrapped and maintenance is a lot of trouble. Generally, it can be operated under windows.

2. Detailed explanation of git commands:

First put a picture of the great god

git commit:

git branch:

git checkout

git merge: We will merge when we are two different branches and generate a new branch

git rebase: I will take my dowry with you

It is found here that if the current branch (master) inherits a child node (for example, C1, the branch is called bugFix), use git merge bugFix; and use git rebase bugFix. Both get the same result: make the branch bugFix and master point to the child node.

Git merge CC merges the record of branch CC with the current branch (whether a merge is generated is determined by whether the current node contains all the commits), while git rebase CC copies the work of the current branch to the CC record.

Test: If the current branch (master) inherits the parent node (for example, C1, the branch is called bugFix), using git rebase bugFix will not generate any commits, prompting "the branch is already the latest"; and the current branch (master) has a child node (For example, C1, the branch is called bugFix), using git merge bugFix will make the current branch master point to C1 as well as bugFix.

(Using git merge and git rebase from the user's point of view, the results are the same, but there is a difference in the merge process, a new commit will be generated, and the rebase will have a linear structure, and the current branch node The last merged position)

HEAD: represents the current point-asterisk "*"

Relative references: ^ and ~

Undo changes: git reset and git revert

git cherry-pick

Interactive rebase

In the pop-up UI interface, you can select the order of moving the last 4 submissions, as shown in the figure:

After confirm, get the following result:

Local stack submission:

Submission Tip 1:

Submission technique 2:

git tags:

git describe:

Select the parent submission record:

Multi-branch processing:

Remote warehouse:

git clone: ​​copy the remote warehouse to the local warehouse

git fetch: download from remote warehouse to local

git pull:

git pull: equivalent to a merged version of git fetch and git merge

Simulate teamwork:

git push: upload local warehouse to remote warehouse

The remote server refused:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin blog.csdn.net/qq_38915078/article/details/107659175