The Computer Oracle

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

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game 5

--

Chapters
00:00 Can You Remove A File From Mercurial Without Removing It From The Filesystem Like Git?
00:18 Answer 1 Score 0
00:28 Accepted Answer Score 16
00:45 Answer 3 Score 5
00:58 Answer 4 Score 2
01:09 Thank you

--

Full question
https://superuser.com/questions/234307/c...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#git #mercurial

#avk47



ACCEPTED ANSWER

Score 16


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.




ANSWER 2

Score 5


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.




ANSWER 3

Score 2


If you need to remove the file from Mercurial history as well, here's a stackoverflow question on how you do this: https://stackoverflow.com/questions/3558365/mercurial-remove-file-from-all-changesets/




ANSWER 4

Score 0


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

http://www.selenic.com/mercurial/hgignore.5.html