Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mercurial - How to remove a file from version control?

So I accidentally included a config file (different for each machine) into our mercurial repositories.

How can I get Mercurial to not include it in version control? I don't want to delete the file since I still want it. And I don't want to cause the file to get deleted on other developer's working directories either.

And how do I do this in TortoiseHG?

like image 209
Greg Avatar asked Jul 14 '10 21:07

Greg


People also ask

How do I delete a file from Mercurial?

Once you decide that a file no longer belongs in your repository, use the hg remove command. This deletes the file, and tells Mercurial to stop tracking it (which will occur at the next commit). A removed file is represented in the output of hg status with a “ R ”.

How do I Untrack a file in Mercurial?

If you see the help for hg rm --help : hg remove [OPTION]... FILE... Schedule the indicated files for removal from the current branch. This command schedules the files to be removed at the next commit.

How do I undo a commit in Mercurial?

You can manually trigger a rollback with 'hg rollback'. This will undo the last transactional command. If a pull command brought 10 new changesets into the repository on different branches, then ' hg rollback ' will remove them all. Please note: there is no backup when you rollback a transaction!

How do I cancel my Mercurial repository?

Jonathan: Removing it is quite proper. We try to keep simple things simple in Mercurial: hg init creates . hg for you, and rm -r . hg will undo that.


1 Answers

Right click on the file -> TortoiseHG -> Forget Files. Click Forget. Commit and Sync.

Edit: You'll also want to add the path to your .hgignore to keep it from getting added again. You can right click on the file in the HG Commit dialog and choose to ignore it.

like image 145
Nate Avatar answered Sep 18 '22 02:09

Nate