Abandoning changes without deleting from history

后端 未结 9 1993
再見小時候
再見小時候 2020-11-28 18:01

There is a commit that just didn\'t work, so I want to abandon it without deleting it from history.

I have updated from an earlier revision and committed, t

9条回答
  •  -上瘾入骨i
    2020-11-28 18:14

    I have run into this issue many times when I want to behead a head that was created in error. I always want to see it disappear off the face of the Earth.

    On your local copy, get the latest and then:

    1. Find the beginning of a head you want to strip (where a new neck starts to branch off), get the revision number

    2. Strip it.


    Source: TipsAndTricks.

    Source: PruningDeadBranches#Using_strip.

    hg --config extensions.hgext.mq= strip -n 
    
    1. Make a trivial file update (add a whitespace to a file), commit and push.

    Your repo should now have the head stripped. The last step is important as stripping doesn't create any changes you can push to your central repository. Without the last step you only have stripped the head locally.

提交回复
热议问题