I'm learning Git and I don't understand why if I do git pull
from the same branch I don't have conflicts, but if I do git pull origin other-branch
I have conflicts.
For example:
case1: I have branch1 with a txt file and I have character "12", then I push it to github, then I modify with "13" on remote. Then I do git pull
and everything is fine I don't have conflicts.
case2: I have the same branch1 and a txt file with "12", then I push it to github. After that I create another branch branch2 from branch1, and I modify "12" with "13", then push to remote to branch2. Then I go back to branch1 and do git pull origin branch2
. This time I have conflicts like this:
Auto-merging bcde.txt
CONFLICT (content): Merge conflict in bcde.txt
Automatic merge failed; fix conflicts and then commit the result.
[pc@pc-PC bca (master *+|MERGING)]$ cat bcde.txt
<<<<<<< HEAD
12
=======
13
So I have "12" and pull "13" from same branch everything is fine, no conflicts, but if I have "12" and pull "13" from other branch this time I have conflicts. Can somebody explain me why I have conflicts?
Thank you!