Changing commit messages

Matt Mackall mpm at selenic.com
Mon Jun 19 15:44:36 CDT 2006


On Mon, Jun 19, 2006 at 08:47:12PM +0200, konrad.hinsen at laposte.net wrote:
> On 19.06.2006, at 18:01, Bryan O'Sullivan wrote:
> 
> >No, there's not an easy way to do it.  I've been pondering  
> >submitting a
> >bug requesting a "recommit" extension that would roll back a commit  
> >and
> >redo it, allowing you to edit the commit message, but that wouldn't  
> >help
> >your problem, since you need to edit *everything*.
> 
> Indeed, though I would appreciate the "recommit" command for those  
> cases where I discover a typo a minute after committing.

Two contradictory points here:

1. The whole point of a version control system is to make permanent
   record of the history. Thus going back and changing things is
   generally Not Allowed, and not accomodated for in the designs of
   such systems. So you should be careful what you commit and accept
   that mistakes will happen.

   Mercurial in particular uses the recursive hash of the tree along
   with commit message itself AND the hash of the same info for a
   commit's parents to generate the version identifier. Thus, you can
   never change something that's already been committed because it has
   a ripple effect.

2. We have a nifty command called 'rollback' (formerly undo) which
   undoes the last transaction, whether it was a pull or a commit. So
   you can, in fact, do hg commit; hg rollback; hg commit and fix a
   commit. But if you've already pushed your changes (or someone has
   pulled from you), your earlier commit has escaped irretrievably
   into the wild. So again, be careful what you commit.

-- 
Mathematics is the supreme nostalgia of our time.


More information about the Mercurial mailing list