How to make a Git merge operation ignore identical changes made to both branches?

Yesterday I had similar issue after a lot of cherry-pick from (and to) a side branch where I after merged with my main branch. A lot of conflicts with identical change. I solved this with a merge strategy:

git checkout main-branch
merge --no-commit -s recursive -X ours side-branch

you can change “ours” to “theirs”. Be careful because all conflicts are automatically solved choosing “ours” or “theirs” side. In my case I had few mis-merges due to this, and I fixed manually. See others interesting options of merge strategies here: https://www.kernel.org/pub/software/scm/git/docs/git-merge.html

You can also try to use a rebase (in my case it did not work well because the branchs were too different and I had a new conflict in each new rebase interaction). See this: http://davitenio.wordpress.com/2008/09/27/git-merge-after-git-cherry-pick-avoiding-duplicate-commits/

Leave a Comment

techhipbettruvabetnorabahisbahis forumu