Git branch operation---Explanation 2
View branches
Create a branch
switch branch
Modify branch
switch branch
merge branches
Merge branches [conflict] (only the main branch will be modified and no other branches will be modified)
When will there be conflict?
The two branches have two different writing methods for the same file and the same location, or there may be conflicts when modifying.
First modify hello.txt on the master branch [My modification is to add the second to last line Go to jjjjjjjjjjj]
Add gggggggg to the penultimate line
, then switch back to the master branch, and then merge. At this time, conflicts will occur.
At this time, we will vim hello.txt
and then you can see where the conflicts occur. Then we manually modify the conflict,
save it after the change
, and then add it to the temporary storage area git add hello.txt
to submit the local library git commit -m "Merge conflict"