Can you remove a file from Mercurial without removing it from the filesystem like Git?

I've got some files in a repo that I don't want tracked, is it possible to remove them without removing the actual files from the filesystem?

This would be equivalent to git's rm --cached.

0

4 Answers

You can use hg forget <file> if files have just been added, however if the files have already been committed use hg rm --after <file>.

The help is a bit misleading, it should be hg rm --do-not-touch-the-filesystem.

It looks like hg forget is what I was looking for according to this.

This will mark a file so that it is no longer tracked after the next commit.

0

If you need to remove the file from Mercurial history as well, here's a stackoverflow question on how you do this:

I believe you can simply ignore them by placing them in a .hgignore file in the folder.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like