开发者

Throw away a bunch of commits in Mercurial

开发者 https://www.devze.com 2023-01-05 13:43 出处:网络
I comitted few times with mercurial and pushed my commits. Nobody else pulled them. How can I \"throw away\" these commits to restore my local and remote repo (both repo and working dir) to a specifie

I comitted few times with mercurial and pushed my commits. Nobody else pulled them. How can I "throw away" these commits to restore my local and remote repo (both repo and working dir) to a specified commi开发者_JAVA百科t? Thank you.


The quickest way is to just clone your local repo to the last 'good' revision, and discard the old one.

This only works if those revisions are the last n in the history.

You can copy the [paths] section of the old repo's .hg/hgrc file to the new one if you want to continue pushing to a third 'master' repo.


You can use $hg revert to revert your code to a previous revision.

If you type $hg help revert into your command line you'll get a list of ways you can revert.

These options include:

--all

--date

--rev

--rev will likely be the one you want since it reverts back to a specific revision.

If the revision you want to revert to is the same as another repo or the same as the current tip, the easiest way then could be to just re-clone that repo.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号