Git: How to discard the merging conflicts with a commit
Now I'm in a merging state. I want to discard all changes, to back to the state that before the merging, and when I do the merge again, it says "Already up-to-date". Is there a nice way to do it?
My attempt: git reset --hard head
but when I do the merge again, still conflict. what I have to do is manually revert all changes by hand and do a empty commit, very tedious.
From what I understood you want to do a merge but, for every conflict, fallback to the version in the original branch instead of the one you are merging with.
If that's the case, tou can try using -Xours
git merge -Xours <name of your other branch>
There's also the option of falling back to the other branch's conflicted changes with -Xtheirs
For more reference, check git's advanced merging docs
Try git merge --abort
It aborts the current merge and takes you back where you were.
链接地址: http://www.djcxy.com/p/41728.html上一篇: Android Studio不断拉相同的项目,并不推动
下一篇: Git:如何用提交丢弃合并冲突