Mercurial:您如何撤消更改?

编程入门 行业动态 更新时间:2024-10-10 09:25:46
本文介绍了Mercurial:您如何撤消更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使用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:您如何撤消更改?

本文发布于:2023-11-09 07:48:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1571778.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Mercurial

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!