I issued hg qnew
without realizing that it includes any outstanding changes into the patch. I'd like to back that out and pick only specific changes using hg qrecord
. How can I undo qnew
?
问问题
1211 次
3 回答
13
您的答案肯定有效——您可以使用较新的 Mercurialhg strip --keep
来避免执行导入步骤:
$ hg strip --keep .
$ hg qdelete patch-name
该--keep
标志使 strip 在工作时忽略工作副本,也就是说,它会删除提交(就像hg qpop
会做的那样),但不会撤消对文件的更改。剥离后,您的系列中仍然有补丁(未应用),然后您可以将其删除。
于 2013-04-18T07:28:12.307 回答
2
我在这里找到了答案:
hg qpop
hg import --no-commit .hg/patches/patch-name
hg qdelete patch-name
如果您知道,请添加更好的方法。
更新:根据奥尔多的回答,还有另一种方法:
hg qnew test
# We can undo the above qnew as:
hg qrefresh -X '*'
hg qpop -f
hg qdelete test
于 2013-04-17T13:09:13.647 回答
2
如果您只想撤消qnew
保留所有本地更改的最新内容,一种选择是:
qcrefresh 123
hg qpop -f
hg qdelete <name of the patch>
请注意,这123
只是一个随机字符串:您告诉 mercurial123
在当前补丁中仅包含(希望不存在)文件。Mercurial 的较新版本在您发出时会发出关于事实123
文件不存在的警告,但这正是我们想要的。
如果要保留当前路径中的某些更改,可以使用crecord扩展qcrefresh
中的命令,它允许以图形方式选择要包含在当前补丁中的更改。您需要从 Bitbucket下载它,提取存档并在以下位置进行配置: .hgrc
[extensions]
crecord = <path/to/crecord/package>
于 2013-04-19T09:05:43.237 回答