What is the difference between hg forget and hg remove?

Paul Nathan picture Paul Nathan · Jul 9, 2009 · Viewed 104.4k times · Source

I want mercurial to remove several files from the current state of the repository. However, I want the files to exist in prior history.

How do forget and remove differ, and can they do what I want?

Answer

Ry4an Brase picture Ry4an Brase · Jul 9, 2009

'hg forget' is just shorthand for 'hg remove -Af'. From the 'hg remove' help:

...and -Af can be used to remove files from the next revision without deleting them from the working directory.

Bottom line: 'remove' deletes the file from your working copy on disk (unless you uses -Af) and 'forget' doesn't.