How to abandon a hg merge?

前端 未结 4 1102
别那么骄傲
别那么骄傲 2020-12-22 21:06

I\'m new to collaborating with Mercurial. My situation:

  • Another programmer changed rev 1 of a file to replace 4-space indents with 2-space indent. (I.e. change
相关标签:
4条回答
  • 2020-12-22 21:19

    BTW: if you just revert the merge you did and 3 is not your revision number you can do this:

    hg update -C -r .
    
    0 讨论(0)
  • 2020-12-22 21:28

    I apparently just needed to hg update -C -r 3, which overwrites my local files with the rev in mind (which is what I thought hg update would do; but I was wrong.) Thanks for my help!

    0 讨论(0)
  • 2020-12-22 21:31

    To undo an uncommitted merge, use

    hg update --clean
    

    which will check out a clean copy of the original merge parent, losing all changes.

    0 讨论(0)
  • 2020-12-22 21:35

    You can discard uncommitted changes with the -C (or --clean) flag:

    hg update -C -r 3
    

    BEWARE: Everything that was not committed will be gone!

    After that you should probably use some kind of code formatter tool to do the entire operation, or at least some find and replace with regular expressions. Something as simple as replacing what matches ^____ (use 4 spaces instead of underscores) with __ (2 spaces), repeated a few times (unless you have insanely some nested code) should work.

    0 讨论(0)
提交回复
热议问题