RFC: Possibility to re-edit last commit message

Martin Pool mbp at canonical.com
Tue Feb 6 02:10:58 GMT 2007


On 29 Jan 2007, John Arbash Meinel <john at arbash-meinel.com> wrote:
> > There are other kinds of mistakes.  I don't worry about it
> > if I misspell something, but on occasion I've noticed I
> > punched in the wrong bug number if I'm including a bug
> > reference, and that is one I want to go back and fix :)
> > 
> > I liked the git syntax as noted by Matthieu:
> > 
> > 	Fyi, this is "commit --amend" in git.
> 
> I know of this syntax, but I think a separate function makes more sense.
> 
> I don't really know how "commit --amend" is implemented. But to me the
> command "commit" is adding new stuff, and shouldn't be replacing the
> existing stuff.
> 
> Hence the desire to name in "bzr recommit". Though we could call it "bzr
> amend-commit" just as easily.
> 
> bzr change-commit
> bzr fix-what-i-just-committed-by-accident
> bzr i-didnt-really-mean-that
> 
> I'm curious how other people feel, though. Aside from "that is how git
> does it", are there reasons to make it part of the commit command,
> rather than a separate command with clearly distinct functionality? (You
> wouldn't have 'bzr commit --uncommit', but maybe 'bzr commit --amend' is
> reasonable)

So it looks like people agreed this shouldn't alter the files included
in the revision, only the revision metadata: mostly the message, but I
suppose possibly also the committer or date.  If you want to change the
contents of the tree it's probably best to uncommit and recommit, since
in this case you might well want to edit files as well as including or
excluding them.

I like Robert's idea of adding a revision property that says that it
supersedes the removed message.

This has some things in common with commit: it (internally) makes a new
revision, and takes options giving a message.  On the other hand it does
not take the file options, and from the user's point of view it's quite
different.

darcs has 'amend-commit' as a separate command.  Maybe 'fix-commit' or
'correct' would be a clear name.  I think 'amend' is ok though.

We should structure the commit code to avoid duplicating special
handling of checkouts etc.

-- 
Martin



More information about the bazaar mailing list