0

I have branches develop and upgraded that I want to merge. Branch upgraded comes from develop but there are about 50 new commits (mainly merges with other branches) on it and much more changes in upgraded. So I want to merge develop into upgraded sequentially (commit by commit), because there are API changes which need to be updated and merge conflicts. But when I do it by simply merging commits from develop it creates new connection for every commit on the graph. I don't really want 50 unnecessary graph paths...

How can I avoid this crazy graph connections? Most gladly using Atlassian Sourcetree GUI.

enter image description here

Daniel Kucal
  • 8,684
  • 6
  • 39
  • 64
  • 1
    Why are you doing this one by one?? – Amit Oct 31 '16 at 22:47
  • Because it's much easier to catch bugs. As I said there were framework api changes and the develop branch still uses old api - it needs to be updated... – Daniel Kucal Oct 31 '16 at 22:59
  • Have a look at [`git imerge`](https://github.com/mhagger/git-imerge). I've never been driven to it so I don't know much beyond that it looks like an exact match for what you're asking for. – jthill Oct 31 '16 at 23:09

2 Answers2

1

If you've already done the work and just want to squash all the merges together, see Squashing a sequence of small merges from master into my branch with git while keeping reference to master? (This uses the command line; it's probably impossible in a GUI, since GUIs are designed to make it easy to do the usual thing, and rarely take unusual things into account at all.)

If you want to do this in the future, git imerge (as mentioned in jthill's comment) does the job. Again, it runs from the command line.

Community
  • 1
  • 1
torek
  • 448,244
  • 59
  • 642
  • 775
0

Create a secondary branch develop-rebase which point to the same tree as develop. You keep the original develop branch in case anything goes wrong. Then, rebase develop-rebase on top of upgraded, which applies each commit sequentially. Do it interactively so that you have a chance to test after each commit.

Hopefully, you will obtain a clean state and apply some patches during this process.

You can stop here if it is enough for you. But if you want a merge from develop to upgraded without intermediate rebases, you can take the diff from your new develop-rebase and develop, apply it on top of develop then get rid of develop-rebase.

Then, make different atomic commits from that patch that explain how you modified develop to make it mergeable with upgraded, and merge.

coredump
  • 37,664
  • 5
  • 43
  • 77