撤消Mercurial中的最后一个addremove吗? [英] Undoing last addremove in Mercurial?

查看:68
本文介绍了撤消Mercurial中的最后一个addremove吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我输入

$ hg addremove

,但后来意识到某些文件不应成为提交的一部分.我应该做的是将这些文件添加到.hgignore中,然后运行addremove和commit.

but later realized that some of the files should not be part of the commit. What I should have done was to add these files to .hgignore and after that run addremove and commit.

有没有办法解决这个问题?

Is there a way of fixing this?

推荐答案

如果尚未提交,请使用hg forget fileToForget或使用Tortoise删除文件.

If you have not commited yet just use hg forget fileToForget or use Tortoise to remove the files.

如果您已提交并且不介意文件成为历史记录的一部分,则只需忘记它们,然后再次提交即可.

If you have committed and you don't mind the files to be part of history, just forget them and commit again.

如果您不希望它们成为存储库历史记录的一部分,并且如果提交它们是您所做的最后一项操作,则可以尝试回滚(使用hg rollback或进入Tortoise中的恢复菜单) ).您将不得不忘记文件,然后再次提交

If you don't want them to be part of your repository history, and if commiting them is the very last operation you've made, you can try to rollback (use hg rollback or go in the recovery menu in Tortoise). You will have to forget the file and then commit again

如果要处理的文件太多,则可以尝试通过获取所有已添加文件的列表,忘记它们,修改您的.hgignore并再次执行addremove来使任务自动化.

If you're dealing with too many files, you can try to automate the task by getting a list of all added files, forgetting them, modify you .hgignore and do the addremove again.

未进行任何提交的Powershell第一步的示例

Example of the first step in powershell with no commit made

hg status --added --no-status | foreach-object {hg forget $_};

这篇关于撤消Mercurial中的最后一个addremove吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆