Possibility of changing the message of an older commit

Stephen J. Turnbull stephen at xemacs.org
Sat Dec 6 04:41:47 GMT 2008

Enrique Ramirez writes:

 > I was wondering if bazaar allows changes to messages and committed
 > dates of older revisions. Like for example, I'm at revision 100 but I
 > just realized that revision 90 had a bogus message that didn't have
 > anything to do to the changes. What I'm looking for would be a way to
 > replace that message and hopefully leave no visible traces on the
 > regular bzr log. Any ideas? Plugins?

No.  None of the modern VCSes will do it for you directly.  If you
really want that feature, I recommend you use git, which provides an
internal design that clearly separates project content (tree objects)
from history (commit objects) and APIs to manipulate chains of commit
objects (git-filter will do this for you).

Note that even in git, if you revise the message at revision 90, you
will also have to recreate the commits of revision 91 .. 100.  If you
have allowed others to clone your repo, then their rev 100 will not be
equal to your rev 100'.  It will appear as tip of a separate branch,
forked after rev 89, with identical content (tree IDs) but different
history (commit IDs).  This is a feature, not a bug.

While users generally don't pay attention to the commit ID, so it will
be effectively invisible in the log, it will be disastrously visible
in use.  Specifically, if you use the same name for the branch with
changed history, enormous confusion will ensue if clones of the
original commit are available anywhere else.  Merges will fail or
generate huge conflicts, etc.

So, just don't do it.  The closest effect that is reasonably safe is

# untested, and I'm not fluent in bzr yet
bzr branch -r 89 . ../tmp-branch
bzr diff -r 89 -r 90 -p1 | patch -d ../tmp-branch -p1
cd ../tmp-branch
bzr commit -m "Corrected message."
# optional, might give prettier logs
# bzr merge -r 91:100 mainline
cd ../mainline
bzr merge ../tmp-branch

More information about the bazaar mailing list