Thread (1 message) 1 message, 1 author, 2016-06-15

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

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:25

David Kastrup [off-list ref] writes:
Junio C Hamano [off-list ref] writes:
...
quoted
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.
No need to be upset about what I said.  I really do not want to
change the minor detail this late in the 1.5.3 release cycle,
and wanted to unblock you by giving an workaround in case you
were stuck.

It should be a straightforward change to git-commit.sh.  Instead
of "Oops, -m and --amend are incompatible so we will whine"
around line 300, you can treat --amend somewhat specially by (1)
making it first not set log_given, which would still keep the
combination of -m/-c/-C/-F incompatible, (2) when $log_given is
false and we are amending, honor $use_commit to prime the
message.  Then you can keep the current bahaviour for amending
starting from the existing message, while allowing -m/-c/-C/-F
to supply different message for the replacing commit.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help