如何还原1个或多个已提交的文件,而不是整个更改集 [英] how do you revert 1 or more committed files in mercurial but NOT the entire changeset
问题描述
说我有文件File_A
,File_B
和File_C
.我故意编辑File_A
和File_B
,但是File_C
我只是添加了一些我不打算提交的调试代码.然后我偶然地做了一个
Say I have files File_A
, File_B
and File_C
. I edit File_A
and File_B
on purpose but File_C
I just added some debugging code that I don't plan to commit. Then by accident I do a
hg commit -m "comment"
如何还原/回滚/回退File_C
?基本上,我很乐意去
How do just revert/rollback/backout File_C
? Basically I'd be happy to be able to go
hg update -r <oneRevBack> File_C
hg commit -m "put C back"
,但更新不使用过滤器AFAIK,因此它还将还原File_A
和File_B
.我可以将File_C
复制到hg update
的某个位置,然后将其复制回去,但这似乎很la脚.有没有办法直接在Mercurial中做到这一点?
but update doesn't take a filter AFAIK so it's also going to revert File_A
and File_B
. I can copy File_C
somewhere, hg update
, then copy it back but that seems lame. Is there a way to do this directly in Mercurial?
推荐答案
如果使用hg revert
而不是hg update
hg revert -r .^ File_C
hg commit -m "put C back"
这篇关于如何还原1个或多个已提交的文件,而不是整个更改集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!