Git branch usage
According to the content of branch in Section 3 of the Git User Manual , use the following:
The newly created new分支
file and master分支
the file operation have the following 3 relationships;
- The document under the master branch is modified under the master branch;
- The document under the new branch is modified under the new branch;
- The master branch and the new branch have modified the same document together;
The result of merging the new branch into the master branch is:
- The files on the master branch are still the records modified on the master branch;
- The files on the new branch will be seen as newly created files on the master branch, and you need to add and commit again;
- There is a conflict between the content on the master branch and the new branch. At this time, Git will pause and wait to resolve the conflict caused by the merge;
How to resolve conflicts arising from the merger
You can use the git status
command at any time after the merge conflict to view those files that contain merged flashes and are in an unmerged state:
The view file appears as follows:
This means that the HEAD
version indicated (that is, your master
position branch is located, because when you run the merge command has been detected to this branch) In this section the upper half ( =======
upper half), while the iss01
branch indicated the version in =======
the lower half. To resolve the conflict, you have to choose from the =======
a split in two parts, or you can merge the contents yourself.
If you add and commit the file according to the content of the Git status prompt, the above-mentioned green and yellow changes will be retained (I am currently doing this).
Or manually choose to keep one item.
According to the introduction in the git manual , you can also use graphical tools to merge, but the attempt was unsuccessful.