Re: git-commit --amend -m "..." complains?!?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> David Kastrup <dak@xxxxxxx> writes:
>
>> I get
>>
>> Option -m cannot be combined with -c/-C/-F/--amend.
>>
>> but that makes no sense: of course there is ample reason for providing
>> an amended commit message on the command line.  -c, -C and -F indeed
>> all provide an alternative commit message, but --amend doesn't.
>
> The option --amend is about "reusing the original commit message
> and make amending edit on top".

Uh no.  From the man page:

	--amend
	   Used to amend the tip of the current branch. Prepare the
	   tree object you would want to replace the latest commit
	   as usual (this includes the usual -i/-o and explicit
	   paths), and the commit log editor is seeded with the
	   commit message from the tip of the current branch. The
	   commit you create replaces the current tip -- if it was a
	   merge, it will have the parents of the current tip as
	   parents -- so the current top commit is discarded.

	   It is a rough equivalent for:

			    $ git reset --soft HEAD^
			    $ ... do something else to come up with the right tree ...
			    $ git commit -c ORIG_HEAD

	   but can be used to amend a merge commit.


The --amend is not, according to the manual page, there to amend the
commit message, but primarily to amend the commit.

If one does not want to amend the message, this is easily done with -C
HEAD.  If one wants to amend the message but not by editing, one is
plain out of luck.

-C, -F and -m are all logically exclusive (and -C -e is the same as
-c).  But --amend seems completely orthogonal to me with regard to the
commit message: it just has a different seed from the normal commit
message edit.  You can override the seed with a normal commit using -c
-C -F and -m.  Why not with --amend?

> If you are restarting the message from scratch, --amend does not
> make much sense.

It amends the _commit_.  You can edit files, add them, and commit
additional changes.  If you are using a dumb terminal (or a system
with nonworking VISUAL over the link in question), you don't _want_ an
editor called up.

> You can do:
>
> 	$ git reset HEAD^
>         $ git commit -m "blah"
>
> if you do not want to reuse the commit message.

You can pretty much _always_ avoid --amend in a similar manner, but
why would you?  It is convenient.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux