We just switched from Subversion to Git.
The problem that came up this morning was that we cherry-picked a commit from a branch into master so maser would have a bug fix. Then we merged master back to the branch.
When we tried to compile, all of the additions from the cherry-picked commit were in the code twice.
The cherry-picked commit consisted of the addition of a couple of lines of code, which ended up afterward being in the code twice. Luckily they were entire functions so it threw a compiler error.
There was never a conflict raised.
How do we avoid this. It’s a major problem.
Thanks.
A cherry-pick is a different commit from Git’s point of view. i.e. when you merge back, you’re merging back a new commit on top of that originally applied.
That is to say, you create a commit with hash
ABC. You cherry-pick it across, creating a new commitDEF. The merge back then appliesDEFalongsideABC.In the above, I would perhaps expect you to simply perform the commit on master (say) and cherry-pick that to your branch.
This blog post has more info.
This blog post details a similar situation and how to use
git rebaseto avoid such issues.