Is there any way to delete local commits in Mercurial?

后端 未结 10 1034
小鲜肉
小鲜肉 2020-11-28 19:11

So I keep making a silly mistake in Mercurial. Often times, I\'ll start work without doing an \"hg pull\" and an \"hg update.\" When I try to push my changes, I get an err

10条回答
  •  借酒劲吻你
    2020-11-28 19:52

    hg strip is what you are looking for. It's analogous of git reset if you familiar with git.

    Use console:

    1. You need to know the revision number. hg log -l 10. This command shows the last 10 commits. Find commit you are looking for. You need 4 digit number from changeset line changeset: 5888:ba6205914681

    2. Then hg strip -r 5888 --keep. This removes the record of the commit but keeps all files modified and then you could recommit them. (if you want to delete files to just remove --keep hg strip -r 5888

提交回复
热议问题