1

On the project we are working I have found a 'git merge' interaction which has left me baffled. I would like to have some insights on it.

We have a project which is being tracked by git. We have the main developing branch 'develop', from this branch there is a branch with some new features 'a'

'develop' has had some commits of others features which has also been merged without problems on 'a' to keep the "final" changes on both sides

At some point we start a new feature 'b' which, by mistake, is branched from 'a' instead of 'develop'. Once the development was completed 'b' got merged into 'develop' and 'a' without problems (at least I can't see them on git log)

After this 'develop' got a new feature branched from 'develop' as it should but now when i try to merge this into 'a' i find that it's taking as if we erased every single commit done in 'a' from it's origin up until the moment we last merged 'b'

I know that there was a huge mistake there branching from 'a' instead of 'develop' but i can't wrap my head around the behaviour it's having

I just want to know if anyone can explain the reason behind this Thanks in advance

DarkAnivia
  • 11
  • 2
  • What merge strategy is in use. You may have accidentally set the strategies to prefer one side over the other, and hence loose 'theirs' (which was deprecated and removed years ago as a 'bad thing') – Philip Oakley Sep 04 '19 at 12:13
  • How do you know that the commits were erased. Do you mean their diffs are not there, or log fails to list them. Do you mean you have 'History Simplification' in effect and it is simply saying "nothing to see here, it's already included. move on" – Philip Oakley Sep 04 '19 at 12:15
  • Well what I see (and therefore thinks that way) is because it gets a conflict and when I'm checking the files involved in the merge there are a lot of deletes of code which only comes from the new feature branch (aka 'a') but they never got to 'develop' so far so it's impossible to have this kind of interaction. – DarkAnivia Sep 06 '19 at 08:53
  • On another side I recently saw that the situation is even more complicated because they merged 'b' on another branch wich came from develop and then merged directly with develop again... it's really a mess... i ended cherrypicking the commits on a real clean branch and start anew all this stuff from scratch – DarkAnivia Sep 06 '19 at 08:54
  • I've updated my answer to add some links to https://git-scm.com/docs/git-log#_history_simplification and another SO Q&A – Philip Oakley Sep 08 '19 at 19:33

1 Answers1

0

I can't see them on git log

it's ta(l)king as if we erased every single commit done in 'a' from it's origin up until the moment we last merged 'b'

I think you are seeing 'History Simplification' in effect and it is simply saying "nothing to see here, it's already included. Move on". Which is a consequence of your merging progress on develop back into the feature branches.


See https://git-scm.com/docs/git-log#_history_simplification (especially the bit about the default simplification) Also Git log history simplification, elaborations example in git log's manual

Community
  • 1
  • 1
Philip Oakley
  • 13,333
  • 9
  • 48
  • 71
  • Not sure it's this case. I'm not making the merge and then reviewing the log, when I try to merge it has a conflict so I'm comparing the files from the merge conflict. As far as I know I can check what changes are being done with the merge and the first thing I found was the deleting of almost all changes of one of the branches – DarkAnivia Sep 16 '19 at 08:02