Abandoning changes without deleting from history

后端 未结 9 1995
再見小時候
再見小時候 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条回答
  •  北海茫月
    2020-11-28 18:24

    I know you don't want to work with branches at this stage, but that's exactly what you've done. When you went back to an earlier version and committed something that worked you created a branch - an unnamed branch, but a branch all the same.


    There's no problem with just carrying on just as you are and not worrying about having multiple heads, but if you want to tidy things up so you don't accidentally pick the wrong head one time then you can kill off the old branch.

    There's a good section in the Mercurial documentation that takes you through a number of options around Pruning Dead Branches.

    I think the best option for you is to mark the old branch as "closed". If your old head is revision "123" then:

    hg update -r 123
    hg commit --close-branch -m 'Closing old branch'
    hg update -C default
    

提交回复
热议问题