开发者

How to use my changes for merge in git?

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 reb开发者_JAVA百科asing 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)


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.


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:

  • remove permanently that directory from your Git repo
  • git push -f (forced push) to a "central" git repo from which the other developers could fetch and reset their own branches.

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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜