如何停止跟踪文件而不在Mercurial上将其删除 [英] How to stop tracking a file without deleting it on Mercurial

查看:73
本文介绍了如何停止跟踪文件而不在Mercurial上将其删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了此线程讨论了git的解决方案,并找到了

I saw this thread which discusses a solution for git, and found this thread on the mailing list for Mercurial (the thread is four years old though)

邮件列表中建议的解决方案是使用hg rm -Af file(并且他们有可能将这种行为作为新的,更直观的选项来实现).我想知道现在是否存在该选项.

The solution proposed in the mailing list is to use hg rm -Af file (and they leave open the possibility of implementing this behavior as a new, more intuitive option). I'm wondering if that option exists now.

此外,如果我尝试上面的命令:

Also, if I try the command above:

> hg rm -Af my_file
> hg st
R my_file

my_file旁边有一个R,但是从技术上讲,文件my_file在磁盘上,我已经告诉Mercurial停止对其进行跟踪,所以为什么要在它旁边添加R? >

there is an R next to my_file, but the file my_file is technically on disk, and I have told Mercurial to stop tracking it, so why am I getting R next to it?

推荐答案

您可以只使用hg forget或将文件添加到您的.hgignore文件

You can just use hg forget or maybe add the file to your .hgignore file

并回答关于my_fileR的最后一个问题.如果您看到hg rm --help的帮助:

And to answer the last question about the R in my_file. If you see the help for hg rm --help:

hg删除[选项] ...文件...

hg remove [OPTION]... FILE...

别名:rm

在下次提交时删除指定的文件

remove the specified files on the next commit

Schedule the indicated files for removal from the current branch.

This command schedules the files to be removed at the next commit. To undo
a remove before that, see "hg revert". To undo added files, see "hg
forget".

Returns 0 on success, 1 if any warnings encountered.

选项:

-A-删除丢失的文件后记录
-f --force删除(和删除)文件,即使已添加或修改
-I --include PATTERN [+]包含与给定模式匹配的名称
-X-排除模式[+]排除与给定模式匹配的名称

-A --after record delete for missing files
-f --force remove (and delete) file even if added or modified
-I --include PATTERN [+] include names matching the given patterns
-X --exclude PATTERN [+] exclude names matching the given patterns

[+]标记的选项可以多次指定

[+] marked option can be specified multiple times

使用汞-v帮助删除"以显示更多信息

use "hg -v help remove" to show more info

如您所见,您正在强制删除该文件,这就是为什么您可以看到R(已删除)

As you can see you are forcing the deletion of that file and that's why you can see the R (Removed)

这篇关于如何停止跟踪文件而不在Mercurial上将其删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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