How to undo bzr add

Asked by Andre Massing

While using completion for bzr add, I hit accidently the return button and therefore added a whole bunch of files which I don't want to add. Is there any easy way to undo that (I suppose there is one) ?

Question information

Language:
English Edit question
Status:
Solved
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Solved by:
Marius Kruger
Solved:
Last query:
Last reply:
Revision history for this message
Vincent Ladeuil (vila) said :
#1

Short answer: 'bzr revert'

Long answer: depending of what modifications you already did before doing 'bzr add', 'bzr revert' may create backups files (ending with ~1~ or more generally ~N~ if previous backups already existed). You may have to rename such backups to their previous names to complete the undo process.

Revision history for this message
Best Marius Kruger (amanica) said :
#2

I'd rather use `bzr remove --keep all the files you did not want to add`
because revert will revert any content changes that you made too.
mm.. it would be nice if revert could take an option eg. --remove-new-only

Revision history for this message
Andre Massing (massing) said :
#3

Den 02.11.10 10.42, skrev Marius Kruger:
> Your question #132154 on Bazaar changed:
> https://answers.launchpad.net/bzr/+question/132154
>
> Marius Kruger proposed the following answer:
> I'd rather use `bzr remove --keep all the files you did not want to add`
> because revert will revert any content changes that you made too.
> mm.. it would be nice if revert could take an option eg. --remove-new-only
>
Thank for your answers so far. The problem is that I added quite a few
files (~100), so it is a very inconvenient solution
to that manually, and as you said I don't want to revert other
modification which I did. So taking up your suggestion and combined
with xargs
via the command:
bzr added -0 | xargs -0 bzr rm --keep

That solves the problem for me, thanks for your help! Btw, it would be
nice to make this somehow more accessible,
especially making e.g bzr status more adaptable to the output (e.g. only
show added / modified / etc files)

Cheers,
Andre

Revision history for this message
Andre Massing (massing) said :
#4

Thanks Marius Kruger, that solved my question.

Revision history for this message
Andre Massing (massing) said :
#5

Just forget my comment about bzr status, just discovered that there is also the other states available via extra bzr commands. Learnt something new :)
Cheers,
Andre