Delete all local changesets and revert to tree

后端 未结 7 639
小蘑菇
小蘑菇 2021-01-29 20:25

I\'m using Mercurial and I\'ve got into a terrible mess locally, with three heads. I can\'t push, and I just want to delete all my local changes and commits and start again with

7条回答
  •  面向向阳花
    2021-01-29 21:08

    hg strip `hg out --template "{rev} {author}\n" | grep YOUR_AUTHOR_NAME | cut -d " " -f 1`

    does the trick for me.

    It strips all revisions that aren't pushed to the default repository which are created with your author name.

    You can also use this style to make it not checking with the default repository but with another Repository

    hg strip `hg out OTHER_REPO_ALIAS --template "{rev} {author}\n" | grep YOUR_AUTHOR_NAME | cut -d " " -f 1`

提交回复
热议问题