tags:

views:

81

answers:

3

I typed in hg add and I am brand new to mercurial and the result of this was a bunch of dll's exe's pdb's etc all got added Nothing's been committed yet and I basically want to undo the add. the documentation for hg forget is not very clear not sure if that is want I want How do I undo the add before the next commit

I do have some real files that need adding so after I can undo the add I will use add with the exclude flag
Thanks

+3  A: 

Check out this mercurial tip. To cite the link - if you have accidentally added a file, the way to undo that (changing its status from A back to ?, or unknown) is hg revert. For example, if you just ran hg add and realized that you do not want files foo or bar to be tracked by Mercurial:

hg revert foo bar
Bozhidar Batsov
+1. Would have been better if you also provided the command itself, though.
Tomislav Nakic-Alfirevic
I don't like to repeat something already written(professional decease I guess :-) ) - the command is added now.
Bozhidar Batsov
A: 

Either revert or remove can be used to un-add not yet commited stuff. However, they both have other uses too, so for clarity hg forget was (re-)added in 1.3, and despite its name it might be easier to remember.

Ry4an
A: 

Two tips for these sorts of situations:

  • If nothing has been commited at all, just delete .hg and start over with hg init.
  • If you do something terrible to your repository and can't seem to figure out how to undo it, (and hg update -C or revert all won't fix), consider cloning the repository at the last good spot.
wsorenson