Mercurial — revert back to old version and continue from there

前端 未结 7 1049
挽巷
挽巷 2020-11-27 09:05

I\'m using Mercurial locally for a project (it\'s the only repo there\'s no pushing/pulling to/from anywhere else).

To date it\'s got a linear history. However, the

7条回答
  •  一个人的身影
    2020-11-27 09:32

    The answers above were most useful and I learned a lot. However, for my needs the succinct answer is:

    hg revert --all --rev ${1}
    
    hg commit -m "Restoring branch ${1} as default"
    

    where ${1} is the number of the revision or the name of the branch. These two lines are actually part of a bash script, but they work fine on their own if you want to do it manually.

    This is useful if you need to add a hot fix to a release branch, but need to build from default (until we get our CI tools right and able to build from branches and later do away with release branches as well).

提交回复
热议问题