Coalescing multiple edits into a single bazaar commit

Occasionally, after committing some changes on a bzr branch, I'll come back to it and want to make further changes.

So, I'll have done something like this:

$ bzr commit
$ # Oops! Forgot to update foo.c. Let's do that now...
$ vim src/foo.c
$ bzr status
modified:
  src/foo.c

But rather than creating a second commit for the newest changes, I'll want to combine those new changes and the changes in the latest commit into a single new commit. How do we do this? With bzr its easy:

$ bzr log -l1 > /tmp/commit.log         # save the latest commit log entry
$ bzr shelve --all -m "latest changes"  # save the latest uncommitted changes
$ bzr uncommit --dry-run                # check its going to work
$ bzr uncommit                          # undo the last commit
$ bzr unshelve --dry-run                # check if its going to work
$ bzr unshelve                          # apply the latest changes to the working directory
$ bzr commit                            # create a new commit containing all the changes
                                        # (here we can make use of '/tmp/commit.log')

Job done.

Comments

Popular posts from this blog

Byobu Bling with Unicode Custom Indicators

Procenv 0.46 - now with more platform goodness

Upstart User Sessions in Ubuntu Raring