How to stop file tracking without deleting it on Mercurial

I saw this thread discussing the solution for git and found this thread on the Mercurial mailing list (although the thread is four years old)

The solution suggested on the mailing list is to use hg rm -Af file (and they leave it possible to implement this behavior as a new, more intuitive option). I am wondering if this option exists.

Also, if I try to execute the command above:

 > hg rm -Af my_file > hg st R my_file 

there is an R next to my_file , but the my_file technically on the disk, and I told Mercurial to stop tracking it, so why do I get an R next to it?

+23
source share
1 answer

You can simply use hg forget or add a file to your .hgignore file

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

hg delete [OPTION] ... FILE ...

aliases: rm

delete the specified files the next time you 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. 

options:

-A - after deleting the entry for missing files
-f --for delete (and delete) the file, even if it is added or modified
-I - enable PATTERN [+] include names matching given patterns
-X --exclude PATTERN [+] exclude names matching given patterns

[+] checked option can be specified several times

use "hg -v help remove" to show additional information

As you can see, you are forcibly deleting this file and why you can see R (deleted)

+20
source

All Articles