[PATCH RFC] commit: add --reuse-message for keeping the old commit message during amend

Pierre-Yves David pierre-yves.david at logilab.fr
Thu Feb 14 04:23:01 CST 2013

On Wed, Feb 13, 2013 at 07:42:44PM +0000, Durham Goode wrote:
> On 2/12/13 8:56 PM, "Matt Mackall" <mpm at selenic.com> wrote:
> >
> >I'm now inclined to think that 'hg commit --amend' will eventually be
> >replaced by 'hg amend', which will have a different default. Then we'll
> >deprecate --amend on commit.
> >
> >So I think we should leave this alone. But I don't think we've got quite
> >enough experience here to add the new amend command yet.

In evolve, I'll probably drop the internal "hg amend" code in favor of using "hg commit
--amend" with an altered editor.

> If anyone feels strongly about getting the extra commit flag in, speak up.
>  For Facebook's purposes we will just add an amend alias for our users
> that does 'hg --config ui.editor=true commit --amend' while we wait for
> the real 'hg amend'.

Note that you have to fix --config in alias first :-)

> As for having amend experience, as I've started using evolve more I've
> found I use an amend flows in three ways:
> 1. (most common) Amending the code in the current commit
> 2. Amending the code in a commit further down.
> 3. (least common) Amending the commit description.

My most common usage are #1 and #3. I usually the "." commit as a "staging area"
slowly adding content and writing the commit message at the end.

The #2 operation is multi step

a) rebase your change on target commit (as hg update with dirty wc does)
b) amend
c) hg evolve --all descendant

It's probably something that we'll want but that requires first class support for multi step operation. Otherwise user will get terribly confused.

> So my ideal "hg amend" would do #1 by default, #2 with "hg amend --to
> 'tip~2'", and #3 with "hg amend -e".  #2 is the only crazy one, but I've
> been using a script that does it in one step and it makes editing chains
> of commits much much easier.

Pierre-Yves David


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20130214/ef269d5f/attachment.pgp>

More information about the Mercurial-devel mailing list