0

Suppose I have a master branch, and a dev branch. After working in the dev branch, I squash and merge it into master

git checkout master
git merge --squash dev 
git commit

This makes a new commit, right? But it seems like running git checkout dev; git merge master spits out already up-to-date. I'm not complaining, but how is this possible. There should be a new commit that conflicts with all the squashed ones, shouldn't there?

Edit: There's no error, I just want to know why there's no error.

Christopher Waugh
  • 441
  • 1
  • 4
  • 15
  • You can always check which commits do you really have with `git log master` or `git log dev` at any moment, no need to assume anything. As for your exact steps, I do not confirm, for me it merges. It may do it without reporting conflict if your changes on both sidea are exactly the same. – max630 Jun 22 '17 at 03:37
  • Yes, it does merge, but I don't know how that's possible. – Christopher Waugh Jun 22 '17 at 15:20
  • Yes, if both sides do same change then it's just accepted without reporting conflict. – max630 Jun 23 '17 at 06:36
  • Oh, I see. I thought changes from multiple commits on the same lines, even identical changes ,would make a conflict. If you post this as an answer, I'll mark it as correct. – Christopher Waugh Jun 23 '17 at 15:41

2 Answers2

0

The branch you have checked out is the one you are modifying. To bring changes from dev to master checkout master and merge dev.

kpie
  • 9,588
  • 5
  • 28
  • 50
0

if both sides do same change then it's just accepted without reporting conflict.

– max630

This is not how I thought merging worked. I assumed multiple commits modifying the same file would at the same location would always cause a conflict. Now it makes sense.

Christopher Waugh
  • 441
  • 1
  • 4
  • 15