Conflict situation one
First, A and B pull the v1 version of the code from the remote warehouse at the same time, and then B first modifies the code to produce the v3 version of the code and submits it successfully, then A modifies the v1 version of the code to produce the v2 version of the code, and wants to submit it to origin/master
, but the latest version of the remote is not the previous v1, and there is a conflict here (identified by the red line).
Examples are as follows
Win here to modify the sorting algorithm to sort from large to small
Then do add
and commit
operation, but nopush
Then the ubuntu side made the following changes
Then do add
, commit
and push
operate on ubuntu
push
At this time , there will be conflicts when doing operations on win
At this point, the input git pull
will automatically help us merge into the local branch, and then we can master
proceedpush
It can be seen that this is an merge
action
Conflict situation two
First modify the README file on the win side
At the same time win here add
and commit
operation, but notpush
Then ubuntu modifies the same location in the README file
Then win here to push
operate again, there is a conflict
then proceedpull
But at this time, because the modified location of win and the pulled version are modified at the same location, a conflict occurs , which cannot be automatically merge
resolved, and must be resolved manually. At this time, the conflicting README file is as follows
Then win here and do add
the operation of commit
and to resolve the conflictpush