0

My repo is straightforward: master, with a dev branch, and an exp branch off of dev. Sometimes when I do what seems like a plain-vanilla merge, git still requires an extra commit, along with the token message "merge exp to dev" -- I thought I understood the reason for this, but apparently I don't.

Git started requiring extra commits on all of my merges, and I thought I could correct it by merging up, that is, from dev to exp, and from master to dev. I guess not. Now I have logs like the following. When I'm on my exp branch, I can't see dev or master in the log:

$ git log --graph --oneline

* 2302e04 (HEAD -> exp) Lock all cell key inits, not just hot
* 05b7207 Allow for asyncAfter not doing barriers properly
*   96a7da8 Merge dispatch queue improvments with bug fixes
|\  
| * 61f0f3e Keep strong ref to dispatch until done with it
| * 6ce8bfe Release stepper before retiring sprites
* | d2acb67 Dedicated dispatch queues for census and clock
|/  
* c466b38 (origin/exp) Remove excess async call wrappers
* c3e0562 Fix calorie intake issues
* f6528b8 More debug to catch dead Arkon carcasses
* 4f78c89 Some debug and some metabolism tweaking
* 79ea6fc Use lock properly when planting manna

And when I switch to dev or master, the log looks like something is seriously wrong:

$ git log --graph --oneline

*   ebf5244 - (HEAD -> master, origin/dev, dev) More merge hell (23 hours ago) 
|\  
| * 6ce8bfe - Release stepper before retiring sprites (24 hours ago) 
| * c466b38 - (origin/exp) Remove excess async call wrappers (4 days ago) 
| * c3e0562 - Fix calorie intake issues (4 days ago) 
* |   ab18fcd - (origin/master, origin/HEAD) Still in merge hell (4 days ago) 
|\ \  
| |/  
| * f6528b8 - More debug to catch dead Arkon carcasses (4 days ago) 
| * 4f78c89 - Some debug and some metabolism tweaking (5 days ago) 
| * 79ea6fc - Use lock properly when planting manna (6 days ago) 
| * ed2fd20 - Fix bloom failure (6 days ago) 
| * 8273def - All manna operations always run in actions (6 days ago) 
* |   6ecefa9 - Merge branch 'exp' into dev, god knows why (8 days ago) 
|\ \  
| |/  
| * de9dc5b - Fix keys transfer bug, freaking finally (8 days ago) 
| * dd7c265 - Simplify cell lock mechanism (2 weeks ago) 
* |   c007107 - Trying to escape merge hell (8 days ago) 
|\ \  
| * \   80114d2 - Merge branch 'dev' (2 weeks ago) 
| |\ \  
| * \ \   218e5c9 - Merge branch 'dev' (2 weeks ago) 
| |\ \ \  
| * \ \ \   5f13180 - Merge branch 'dev' (3 weeks ago) 
| |\ \ \ \  
| * \ \ \ \   e4150f5 - Merge branch 'dev' (4 weeks ago) 
| |\ \ \ \ \  
| * \ \ \ \ \   e7cd064 - Merge branch 'dev' (4 weeks ago) 
| |\ \ \ \ \ \  
| * \ \ \ \ \ \   95bc8f8 - Merge branch 'dev' (6 weeks ago) 
| |\ \ \ \ \ \ \  
| * \ \ \ \ \ \ \   da3500d - Merge branch 'dev' (7 weeks ago) 
| |\ \ \ \ \ \ \ \  
| * \ \ \ \ \ \ \ \   4b45133 - Merge branch 'dev' (8 weeks ago) 
| |\ \ \ \ \ \ \ \ \  
| * \ \ \ \ \ \ \ \ \   a3498b7 - Grr, more weird branch merge stuff (10 weeks ago) 
| |\ \ \ \ \ \ \ \ \ \  
| * \ \ \ \ \ \ \ \ \ \   e9b0429 - Merge branch 'dev' (3 months ago) 
| |\ \ \ \ \ \ \ \ \ \ \  
:

And I still can't merge from dev to master, or from exp to dev, without needing an extra commit again. I don't know what's causing it. It seems like the hierarchical relationships between the branches have been lost.

I don't even know where to start on figuring out this problem, I don't know where to look. Googling "broken branch history" turns up a lot of stuff about fixing the history of a single branch, nothing about the relationships among branches.

What's the most effective way to approach the problem? What keywords could I google to get relevant information? Is there a specific name for this problem?

SaganRitual
  • 2,921
  • 2
  • 20
  • 35
  • 4
    Please read [this question](https://stackoverflow.com/questions/9069061/what-is-the-difference-between-git-merge-and-git-merge-no-ff) to perhaps better understand the source of this mystery extra commit which is appearing after merges. As for your actual problem, your diagrams are too messy for to take a chance on an answer. – Tim Biegeleisen Dec 27 '19 at 08:09
  • Although they're also too messy for me to read, the diagrams are the output from git log, so I figure (hope!) someone will know how to read them. Thanks for the link – SaganRitual Dec 27 '19 at 08:11
  • 4
    *Commits* have relationships, but they are ancestor/descendant, not hierarchical. Branch names have no relationships at all. See https://stackoverflow.com/questions/25068543/what-exactly-do-we-mean-by-branch – torek Dec 27 '19 at 08:34
  • 1
    Your branches have diverged. If you should (fast-forward) merge one into the other (X -> Y) after doing the opposite (Y -> X), they'd end up identical and you could thereby have a linear history from that point on, given that you rebase before you merge. You should find information about Git's branching and object model and read up on that. It would perhaps make things more clear. – jsageryd Dec 27 '19 at 13:07

0 Answers0