1

I had a problem while I was trying to synchronize my development branch with the master and now I am trying to understand what happened. The main problem was that I tried two things and each had a different outcome.

After checking out to my development branch, I used the command "git merge origin/master". I got some git conflicts and I fixed them. After a few minutes I tried to re-synchronize the branches by using the following commands:

1. git checkout master
2. git pull
3. git checkout dev_branch
4. git pull
5. git merge master

After using these commands, I got other git conflicts(on different files), but different from the previous ones.

Why did I get different conflicts? I have to mention, once again, that I re-synchronized the branches after a very short period of time and I am pretty sure that the remote master didn't get any updates in the meantime. Is there any difference between these 2 methods? If yes, what is it?

Henrik Joe
  • 21
  • 1

1 Answers1

1

Chances are your local origin/master wasn't up to date.
One of the (expected) effects of git pull is to update origin/master.


You can confirm this by looking at the history of your local dev_branch :

If you look at the history of your branch (using git-kraken, or gitg, or gitk, or git log --graph --oneline), you should see two distincts merges :

  * (dev_branch) Merge branch 'master' into dev_branch   # <- merge2
  |\
  | * (master, origin/master) commit aaa                 # <- aaa
  | |
     ...
  |
  *  | Merge banch 'origin/master' into dev_branch       # <- merge1
  |\ /
  | * commit bbb                                         # <- bbb
  | |
     ...

bbb was the state of your local origin/master at your first merge, aaa is the state of master after your git pull (and it is probably be the same as origin/master).

Another possibility is that your local master branch is not the same as origin/master.

LeGEC
  • 46,477
  • 5
  • 57
  • 104