maaartinus
maaartinus

Reputation: 46422

Git merge vs cherry-pick for two differing branches

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:

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?

Upvotes: 1

Views: 139

Answers (1)

VonC
VonC

Reputation: 1324337

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>...

Upvotes: 1

Related Questions