使用Mercurial时,如何撤消自上次提交以来工作目录中的所有更改?看起来这很简单,但是却在逃避我.
When using Mercurial, how do you undo all changes in the working directory since the last commit? It seems like this would be a simple thing, but it's escaping me.
例如,假设我有4次提交.然后,我对代码进行了一些更改.然后,我决定我的更改是错误的,我只想回到上一次提交时的代码状态.因此,我认为我应该这样做:
For example, let's say I have 4 commits. Then, I make some changes to my code. Then I decide that my changes are bad and I just want to go back to the state of the code at my last commit. So, I think I should do:
hg update 4,其中4是我最近一次提交的修订版本号.但是,Mercurial不会更改我的工作目录中的任何文件.为什么不呢?
with 4 being the revision # of my latest commit. But, Mercurial doesn't change any of the files in my working directory. Why not?
推荐答案就能解决问题.
它将使您恢复到上一次提交.
It will revert you to the last commit.
--all将还原所有文件.
有关其手册页说明的信息,请参见链接.
See the link for the Man Page description of it.
hg update通常用于在从其他仓库或交换分支中拉出后刷新工作目录. hg up myawesomebranch.它还可以用于还原到特定版本. hg up -r 12.
hg update is usually used to refresh your working directory after you pull from a different repo or swap branches. hg up myawesomebranch. It also can be used to revert to a specific version. hg up -r 12.
更多推荐
Mercurial:您如何撤消更改?
发布评论