What is better way to remove commit from history?
Erik Bågfors
zindar at gmail.com
Tue Mar 18 12:11:21 GMT 2008
On Tue, Mar 18, 2008 at 12:31 PM, James Westby
<jw+debian at jameswestby.net> wrote:
>
> On Tue, 2008-03-18 at 13:01 +0200, Alexander Belchenko wrote:
> > I have some branch where I commit wrong thing. After that I have 5 another commits.
> > And only then I realize that committed file is completely wrong therefore
> > should not be used in real work.
> >
> > I'd like to cleanup history of my branch (rewrite it) to remove that wrong commit.
> > What is the best way to do this? rebase? loom?
>
> rebase is the strategy to use I think.
>
> Unfortunately I can't give you exact instructions of how to do it with
> the bzr-rebase tool, sorry.
>
I don't really see how rebase can be used for that. I haven't used it
that much though.
I would use shelve/unshelve. It requires you to rewrite the commit
messages though.
# Uncommit the "wanted" commits and put them on the shelf
bzr uncommit
bzr shelve --all
# repeat the above 5 times (if you have 5 commits you'd like to keep)
# Remove the unwanted commit
bzr uncommit
bzr revert
# Put back the wanted commits again
bzr unshelve
bzr ci -m message
# repeate the above until done.
Not the easiest way to do it... but it does work.
/Erik
More information about the bazaar
mailing list