mercurial 在提交之前丢弃所有添加的文件

标签 mercurial

刚刚犯了一个错误,使用 addremove 尝试删除一些没有使用 hg remove

就被删除的文件

现在有数百个文件将在下一次提交时添加

我是否可以快速删除所有这些添加的文件,而无需使用 bash 脚本,甚至更糟糕的是 hg removeforgetting 手动每个文件?

最佳答案

如果您只想使用内部 hg 命令,可以执行以下操作:

hg forget "set:added()"

这将忘记工作目录中标记为“已添加”的任何文件。它利用了相当强大的filesets Mercurial 的功能。

您可以在指定文件时使用其他过滤器,从而轻松修复其他错误。例如,轻松地重新添加已删除的文件,但仅此而已hg add "set:removed()"。该功能类似于(幸好比)mercurial revsets ,并且可以通过以下方式研究:

hg help filesets

关于mercurial 在提交之前丢弃所有添加的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13510787/

相关文章:

templates - 如何限制 Mercurial 日志的大小?

mercurial - 按分支名称过滤 Mercurial 状态

eclipse - Windows 7 64 位 : doesn't install "Windows Binaries for Mercurial" 上的 MercurialEclipse

Mercurial:删除最后一次提交

Mercurial 2.3 - 为什么 {latesttag} 为空?

Mercurial:回滚 "hg commit --amend"。

mercurial - tortoise hg 将两个独立的 Mercurial 项目克隆到同一目录

mercurial - 如何在CentOS6 中更新Mercurial 客户端?

Mercurial 内部 :merge and binary file conflicts

mercurial - 两个命名分支的 Mercurial merge : Working Directory Has No Ancestor