{"thread":{"id":"9340","subject":"git-commit --amend -m \"...\" complains?!?","startedAt":"2007-08-01T14:25:16Z","lastAt":"2007-08-02T01:03:16Z","messageCount":7,"participants":["David Kastrup","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"49313","messageId":"86643znxgz.fsf@lola.quinscape.zz","threadId":"9340","inReplyTo":null,"subject":"git-commit --amend -m \"...\" complains?!?","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-08-01T14:25:16Z","receivedAt":"2007-08-01T14:25:16Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"\nI get\n\nOption -m cannot be combined with -c/-C/-F/--amend.\n\nbut that makes no sense: of course there is ample reason for providing\nan amended commit message on the command line.  -c, -C and -F indeed\nall provide an alternative commit message, but --amend doesn't.\n\nSo what is the beef?\n\n-- \nDavid Kastrup\n"},{"id":"49328","messageId":"7v8x8v5g2z.fsf@assigned-by-dhcp.cox.net","threadId":"9340","inReplyTo":"86643znxgz.fsf@lola.quinscape.zz","subject":"Re: git-commit --amend -m \"...\" complains?!?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-01T17:18:12Z","receivedAt":"2007-08-01T17:18:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Kastrup <dak@gnu.org> writes:\n\n> I get\n>\n> Option -m cannot be combined with -c/-C/-F/--amend.\n>\n> but that makes no sense: of course there is ample reason for providing\n> an amended commit message on the command line.  -c, -C and -F indeed\n> all provide an alternative commit message, but --amend doesn't.\n\nThe option --amend is about \"reusing the original commit message\nand make amending edit on top\".  If you are restarting the\nmessage from scratch, --amend does not make much sense.\n\nYou can do:\n\n\t$ git reset HEAD^\n        $ git commit -m \"blah\"\n\nif you do not want to reuse the commit message.\n"},{"id":"49341","messageId":"85myxbrrdl.fsf@lola.goethe.zz","threadId":"9340","inReplyTo":"7v8x8v5g2z.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-commit --amend -m \"...\" complains?!?","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-08-01T19:23:18Z","receivedAt":"2007-08-01T19:23:18Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> David Kastrup <dak@gnu.org> writes:\n>\n>> I get\n>>\n>> Option -m cannot be combined with -c/-C/-F/--amend.\n>>\n>> but that makes no sense: of course there is ample reason for providing\n>> an amended commit message on the command line.  -c, -C and -F indeed\n>> all provide an alternative commit message, but --amend doesn't.\n>\n> The option --amend is about \"reusing the original commit message\n> and make amending edit on top\".\n\nUh no.  From the man page:\n\n\t--amend\n\t   Used to amend the tip of the current branch. Prepare the\n\t   tree object you would want to replace the latest commit\n\t   as usual (this includes the usual -i/-o and explicit\n\t   paths), and the commit log editor is seeded with the\n\t   commit message from the tip of the current branch. The\n\t   commit you create replaces the current tip -- if it was a\n\t   merge, it will have the parents of the current tip as\n\t   parents -- so the current top commit is discarded.\n\n\t   It is a rough equivalent for:\n\n\t\t\t    $ git reset --soft HEAD^\n\t\t\t    $ ... do something else to come up with the right tree ...\n\t\t\t    $ git commit -c ORIG_HEAD\n\n\t   but can be used to amend a merge commit.\n\n\nThe --amend is not, according to the manual page, there to amend the\ncommit message, but primarily to amend the commit.\n\nIf one does not want to amend the message, this is easily done with -C\nHEAD.  If one wants to amend the message but not by editing, one is\nplain out of luck.\n\n-C, -F and -m are all logically exclusive (and -C -e is the same as\n-c).  But --amend seems completely orthogonal to me with regard to the\ncommit message: it just has a different seed from the normal commit\nmessage edit.  You can override the seed with a normal commit using -c\n-C -F and -m.  Why not with --amend?\n\n> If you are restarting the message from scratch, --amend does not\n> make much sense.\n\nIt amends the _commit_.  You can edit files, add them, and commit\nadditional changes.  If you are using a dumb terminal (or a system\nwith nonworking VISUAL over the link in question), you don't _want_ an\neditor called up.\n\n> You can do:\n>\n> \t$ git reset HEAD^\n>         $ git commit -m \"blah\"\n>\n> if you do not want to reuse the commit message.\n\nYou can pretty much _always_ avoid --amend in a similar manner, but\nwhy would you?  It is convenient.\n\n-- \nDavid Kastrup, Kriemhildstr. 15, 44793 Bochum\n"},{"id":"49344","messageId":"7vk5sf3uct.fsf@assigned-by-dhcp.cox.net","threadId":"9340","inReplyTo":"85myxbrrdl.fsf@lola.goethe.zz","subject":"Re: git-commit --amend -m \"...\" complains?!?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-01T19:52:50Z","receivedAt":"2007-08-01T19:52:50Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Kastrup <dak@gnu.org> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n> ...\n>> You can do:\n>>\n>> \t$ git reset HEAD^\n>>         $ git commit -m \"blah\"\n>>\n>> if you do not want to reuse the commit message.\n>\n> You can pretty much _always_ avoid --amend in a similar manner, but\n> why would you?  It is convenient.\n\nNo need to be upset about what I said.  I really do not want to\nchange the minor detail this late in the 1.5.3 release cycle,\nand wanted to unblock you by giving an workaround in case you\nwere stuck.\n\nIt should be a straightforward change to git-commit.sh.  Instead\nof \"Oops, -m and --amend are incompatible so we will whine\"\naround line 300, you can treat --amend somewhat specially by (1)\nmaking it first not set log_given, which would still keep the\ncombination of -m/-c/-C/-F incompatible, (2) when $log_given is\nfalse and we are amending, honor $use_commit to prime the\nmessage.  Then you can keep the current bahaviour for amending\nstarting from the existing message, while allowing -m/-c/-C/-F\nto supply different message for the replacing commit.\n"},{"id":"49348","messageId":"85zm1bq8um.fsf@lola.goethe.zz","threadId":"9340","inReplyTo":"857iofrnkj.fsf@lola.goethe.zz","subject":"[PATCH] git-commit.sh: Permit the --amend message to be given with -m/-c/-C/-F.","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-08-01T20:33:47Z","receivedAt":"2007-08-01T20:33:47Z","isPatch":true,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"\nSigned-off-by: David Kastrup <dak@gnu.org>\n---\n git-commit.sh |    5 ++---\n 1 files changed, 2 insertions(+), 3 deletions(-)\n\ndiff --git a/git-commit.sh b/git-commit.sh\nindex 4290ae2..d7e7028 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -190,7 +190,6 @@ $1\"\n \t\t;;\n \t--a|--am|--ame|--amen|--amend)\n \t\tamend=t\n-\t\tlog_given=t$log_given\n \t\tuse_commit=HEAD\n \t\tshift\n \t\t;;\n@@ -298,9 +297,9 @@ esac\n \n case \"$log_given\" in\n tt*)\n-\tdie \"Only one of -c/-C/-F/--amend can be used.\" ;;\n+\tdie \"Only one of -c/-C/-F can be used.\" ;;\n *tm*|*mt*)\n-\tdie \"Option -m cannot be combined with -c/-C/-F/--amend.\" ;;\n+\tdie \"Option -m cannot be combined with -c/-C/-F.\" ;;\n esac\n \n case \"$#,$also,$only,$amend\" in\n-- \n1.5.3.rc2.84.gd0bef-dirty\n"},{"id":"49347","messageId":"857iofrnkj.fsf@lola.goethe.zz","threadId":"9340","inReplyTo":"7vk5sf3uct.fsf@assigned-by-dhcp.cox.net","subject":"Re: git-commit --amend -m \"...\" complains?!?","fromName":"David Kastrup","fromEmail":"dak@gnu.org","sentAt":"2007-08-01T20:45:32Z","receivedAt":"2007-08-01T20:45:32Z","isPatch":false,"sender":{"key":"dak@gnu.org","avatar":"https://avatars.githubusercontent.com/u/52141349?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> David Kastrup <dak@gnu.org> writes:\n>\n>> Junio C Hamano <gitster@pobox.com> writes:\n>> ...\n>>> You can do:\n>>>\n>>> \t$ git reset HEAD^\n>>>         $ git commit -m \"blah\"\n>>>\n>>> if you do not want to reuse the commit message.\n>>\n>> You can pretty much _always_ avoid --amend in a similar manner, but\n>> why would you?  It is convenient.\n>\n> No need to be upset about what I said.  I really do not want to\n> change the minor detail this late in the 1.5.3 release cycle, and\n> wanted to unblock you by giving an workaround in case you were\n> stuck.\n\nWell, there is always\nVISUAL='echo \"mycommit\" >\"$1\"' git commit --amend \nUh, no wait, it isn't.  Different thread.\n\n> It should be a straightforward change to git-commit.sh.  Instead of\n> \"Oops, -m and --amend are incompatible so we will whine\" around line\n> 300, you can treat --amend somewhat specially by (1) making it first\n> not set log_given, which would still keep the combination of\n> -m/-c/-C/-F incompatible, (2) when $log_given is false and we are\n> amending, honor $use_commit to prime the message.\n\nI actually can't find anything about (2) to be done in the code.\n\n> Then you can keep the current bahaviour for amending starting from\n> the existing message, while allowing -m/-c/-C/-F to supply different\n> message for the replacing commit.\n\nIn a somewhat different vein: it appears strange that -m is treated\ncompletely different from the other commit message specifiers: you can\nspecify -m multiple times.\n\nI have not changed this in the slightly tested patch posted\nseparately: while the --amend fix was quite straightforward and\nconfined (and indeed, not even the documentation appears to warrant\nany modification), the m/t mess is something I really don't want to\nmess with right now.\n\n-- \nDavid Kastrup, Kriemhildstr. 15, 44793 Bochum\n"},{"id":"49381","messageId":"7vd4y63fzf.fsf@assigned-by-dhcp.cox.net","threadId":"9340","inReplyTo":"85zm1bq8um.fsf@lola.goethe.zz","subject":"Re: [PATCH] git-commit.sh: Permit the --amend message to be given with -m/-c/-C/-F.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-08-02T01:03:16Z","receivedAt":"2007-08-02T01:03:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Kastrup <dak@gnu.org> writes:\n\n> Signed-off-by: David Kastrup <dak@gnu.org>\n> ---\n>  git-commit.sh |    5 ++---\n>  1 files changed, 2 insertions(+), 3 deletions(-)\n>\n> diff --git a/git-commit.sh b/git-commit.sh\n> index 4290ae2..d7e7028 100755\n> --- a/git-commit.sh\n> +++ b/git-commit.sh\n> @@ -190,7 +190,6 @@ $1\"\n>  \t\t;;\n>  \t--a|--am|--ame|--amen|--amend)\n>  \t\tamend=t\n> -\t\tlog_given=t$log_given\n>  \t\tuse_commit=HEAD\n>  \t\tshift\n>  \t\t;;\n> @@ -298,9 +297,9 @@ esac\n>  \n>  case \"$log_given\" in\n>  tt*)\n> -\tdie \"Only one of -c/-C/-F/--amend can be used.\" ;;\n> +\tdie \"Only one of -c/-C/-F can be used.\" ;;\n>  *tm*|*mt*)\n> -\tdie \"Option -m cannot be combined with -c/-C/-F/--amend.\" ;;\n> +\tdie \"Option -m cannot be combined with -c/-C/-F.\" ;;\n>  esac\n>  \n>  case \"$#,$also,$only,$amend\" in\n\nOk, looks obviously correct.  Wasn't too painful, was it?\n\nThanks, will apply.\n"}]}