2

Lets say I have three branches, W, M and F. Branch W is the one I am working on, branch M is "master", and branch F is an earlier bug-fixing branch. W is based on M, F have been merged into M some time ago. W have been synced (merged) from M from time to time.

Something like

   ,--.  branch F
  /    \
-+------+--+------+------+------+------   branch M
            \      \      \      \
             `------+------+------+----   branch W

The problem is that after the merge of F into M, those changes were missed in a merge from M to W. So now I want to merge from F into W, but git says that branch W already is up-to-date, which technically it is but it's still missing the parts from F.

How can I re-merge from F into W?

I want something like


       ,--+-----------------------------------.       branch F
      /    \                                   \
     /      \       ,------+------+------+------+---  branch W
    /        \     /      /      /      /
---+----------+----+-----+------+------+------------  branch M

Is this possible? And if so, how?

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621

1 Answers1

0

This is one case where git cherry-pick would be easier than attempting a merge.

See "How to cherry pick a range of commits and merge into another branch".

If "F" still references the commit before the merge into M, you can use the range M..F
(ie. all commits accessible from F, but not from M).

git checkout W
git cherry-pick M..F
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Unfortunately that didn't work, git reported "empty commit set passed" for that. – Some programmer dude Nov 20 '13 at 14:09
  • I also tried just `git cherry-pick F` and it merges *some* of the things from `F` but not all. – Some programmer dude Nov 20 '13 at 14:10
  • @JoachimPileborg strange `fatal: empty commit set passed` means the range of commit you passed is empty (http://git.661346.n2.nabble.com/cherry-pick-revert-error-messages-td7013134i40.html) – VonC Nov 20 '13 at 14:49
  • @JoachimPileborg try first to list the commits you want, with a `git log`, as in http://stackoverflow.com/a/20095458/6309 (without the `--name-only`). then try the cherry-pick with that range of commits. – VonC Nov 20 '13 at 14:52