tags:

views:

57

answers:

3

How do I force "my changes" when merging in git? Someone put all bin directories in git and now I have a terrible merge conflict :(

Now it says the following:

When you have resolved this problem run "git rebase --continue". If you would prefer to skip this patch, instead run "git rebase --skip". To restore the original branch and stop rebasing run "git rebase --abort".

I do NOT want to merge, i just want to delete all those files using my changes.

EDIT: Most of the files was successfully merged, either through automatic merge or because there was no conflict. However quite a few still exist like the following one.

warning: Cannot merge binary files: src/reports/obj/Debug/TempPE/GroupMailDS.Designer.cs.dll (HEAD vs. added gitignore)

A: 

You can:

  • git rm the obj directory (which contains all those binary files and shouldn't have been committed in the first place)
  • add a .gitignore directive to make sure any future obj directory won't appear in the git status (and won't be added)
  • git push that new tree, helping to propagate the fact that 'obj' directory should disappear from other Git repos as well (hence triggering no merge at all).

If you can have the consent of all the other participants, you could:

But since it involves replacing published history by a new one, it should be done only if the other users agree.

VonC
It makes sense. I never thought of deleting the directory:)
mhenrixon
A: 

I guess you can just replace their binaries with yours (since no merge is really possible) or just git rm the unwanted binaries. After you have done, just git rebase --continue

insidepower
Or even better, like VonC suggested to git rm the directory
mhenrixon
+2  A: 

I'm not 100% confident about this, but I think this is a good case for this:

git merge otherbranch -s recursive -X ours

That command attempts to merge the topic branch into your checked out branch using the recursive strategy. The -X ours option is a subset of the recursive strategy that automatically resolves conflicts by making the assumption that your currently checked out branch is authoritative.

Bryce
I have to try this because if that works that's greatness beyond the power of the darkside for anyone responsible of jedi/master!
mhenrixon
Wow! That's exactly what I was looking for. Talk about ludicrous speed! :) I believe it's a perfect situation to use this. All I wanted was to overwrite the other branch with my changes in case of conflicts even if it wasn't exactly what I asked for :)
mhenrixon