1

I'm having two branches without a common ancestor, let's call them master and other. Their content differs a lot and this has to stay. New changes are nearly always done on master and cherry-picked to other with some manual merging, which can't be eliminated. This won't change either.

I wonder what are the consequences of fake-merging master into other like this

git checkout other
git merge -s ours master

and then always merging instead of cherry-picking. The advantages are clear:

  • it obviates the need to remember what to cherry-pick
  • it allows to merge multiple changes at once (which may be sometimes easier)
  • it establishes a clear relationship between the branches

I can imagine that it makes my life a bit harder in the rare cases when something doesn't need to be picked into the other branch, but this is no real problem. Before I do it, I'd like to know if there are any disadvantages I'm unaware of?

maaartinus
  • 44,714
  • 32
  • 161
  • 320

1 Answers1

1

No obvious disadvantages, especially when compared to the ones of cherry-picking, namely;

So fake merging allows you to reset the merge common ancestor to a more recent commit, and from there merge only what you needs.

Note there are solution for merging all files except one or two:

git reset <paths>...
git add -p <paths>...
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Sounds good and you seem to know what you're saying. The question is why I didn't come to this idea earlier? I've never seen anyone recommending this fake-merge. – maaartinus Jun 05 '14 at 05:33
  • @maaartinus because most of the time, it involves only reporting a few commits over to a branch, not "all commits except a file or two". In the formar case, cherry-picking is the usual solution. – VonC Jun 05 '14 at 05:35