{"thread":{"id":"6511","subject":"[PATCH] Documentation: --amend cannot be combined with -c/-C/-F.","startedAt":"2007-01-24T19:54:46Z","lastAt":"2007-01-25T22:38:05Z","messageCount":4,"participants":["Peter Eriksen","Mark Wooding","Junio C Hamano","Matthias Lederhofer"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"32550","messageId":"20070124195446.GA13817@bohr.gbar.dtu.dk","threadId":"6511","inReplyTo":null,"subject":"[PATCH] Documentation: --amend cannot be combined with -c/-C/-F.","fromName":"Peter Eriksen","fromEmail":"s022018@student.dtu.dk","sentAt":"2007-01-24T19:54:46Z","receivedAt":"2007-01-24T19:54:46Z","isPatch":true,"sender":{"key":"s022018@student.dtu.dk","avatar":null},"body":"We used to get the following confusing error message:\n\n% git commit --amend -a -m foo\nOption -m cannot be combined with -c/-C/-F\n\nThis is because --amend cannot be combined with -c/-C/-F, which makes\nsense, because they try to handle the same log message in different ways.\nSo update the documentation to reflect this.\n\nSigned-off-by: Peter Eriksen <s022018@student.dtu.dk>\n---\n\nThis problem was reported by tko on #git.  What do you think?\nIt is not a \"complete\" fix, since --reuse, and --reedit have the same\nproblem, but they are not even mentioned in the man page of git-commit. \n\n Documentation/git-commit.txt |    4 ++--\n git-commit.sh                |    6 +++---\n 2 files changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 532703a..2187eee 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -8,8 +8,8 @@ git-commit - Record changes to the repository\n SYNOPSIS\n --------\n [verse]\n-'git-commit' [-a] [-s] [-v] [(-c | -C) <commit> | -F <file> | -m <msg>]\n-\t   [--no-verify] [--amend] [-e] [--author <author>]\n+'git-commit' [-a] [-s] [-v] [(-c | -C) <commit> | -F <file> | -m <msg> |\n+\t    --amend] [--no-verify] [-e] [--author <author>]\n \t   [--] [[-i | -o ]<file>...]\n \n DESCRIPTION\ndiff --git a/git-commit.sh b/git-commit.sh\nindex 6f4dcdb..830ba76 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -3,7 +3,7 @@\n # Copyright (c) 2005 Linus Torvalds\n # Copyright (c) 2006 Junio C Hamano\n \n-USAGE='[-a] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit>] [-u] [--amend] [-e] [--author <author>] [[-i | -o] <path>...]'\n+USAGE='[-a] [-s] [-v] [--no-verify] [-m <message> | -F <logfile> | (-C|-c) <commit> | --amend] [-u] [-e] [--author <author>] [[-i | -o] <path>...]'\n SUBDIRECTORY_OK=Yes\n . git-sh-setup\n require_work_tree\n@@ -284,9 +284,9 @@ esac\n \n case \"$log_given\" in\n tt*)\n-\tdie \"Only one of -c/-C/-F can be used.\" ;;\n+\tdie \"Only one of -c/-C/-F/--a can be used.\" ;;\n *tm*|*mt*)\n-\tdie \"Option -m cannot be combined with -c/-C/-F.\" ;;\n+\tdie \"Option -m cannot be combined with -c/-C/-F/--a.\" ;;\n esac\n \n case \"$#,$also,$only,$amend\" in\n-- \n1.5.0.rc2.gc9a89-dirty\n"},{"id":"32602","messageId":"slrnerh8la.7v0.mdw@metalzone.distorted.org.uk","threadId":"6511","inReplyTo":"20070124195446.GA13817@bohr.gbar.dtu.dk","subject":"Re: [PATCH] Documentation: --amend cannot be combined with -c/-C/-F.","fromName":"Mark Wooding","fromEmail":"mdw@distorted.org.uk","sentAt":"2007-01-25T12:29:30Z","receivedAt":"2007-01-25T12:29:30Z","isPatch":true,"sender":{"key":"mdw@distorted.org.uk","avatar":null},"body":"Peter Eriksen <s022018@student.dtu.dk> wrote:\n\n> We used to get the following confusing error message:\n>\n> % git commit --amend -a -m foo\n> Option -m cannot be combined with -c/-C/-F\n\nHmm.  The log-message options to git commit seem confused to me.\n\nThe default behaviour is to fire up an editor for the user to provide a\nmessage.  The editor buffer may be pre-initialized, e.g., because\nMERGE_MSG exists.\n\nThis default behaviour can be overridden in a number of ways:\n\n  * -m forces the message to be its argument;\n  * -F forces the message to be the contents of some file;\n  * -C forces the message to be a copy of some other commit message.\n\nSo far, so good.  One can see why all of these options are mutually\nexclusive.  The problem is in the mess of other options like -c and\n--amend.\n\nCurrently -c (copy some other commit message, and then edit it) is\nconsidered to be a `force message to be...' kind of option, like the\nothers I've listed above.\n\nSo, for some reason, is --amend.  This last is really annoying.  I\nfrequently find that I end up typing\n\n  VISUAL=: git commit --amend ...\n\nto fix the stupid thing I forgot to do before I committed last time.\nNo, dammit, I don't want to mess with the editor.\n\nSomewhere in all of this is a fairly nice, regular set of operations trying to\nescape.  There are two processes at work:\n\n  * setting a default message, and\n  * maybe getting the user to edit it.\n\nThe first part is slightly complicated: there are a number of places to\nget a default message from, and several might be possible:\n\n  * explicitly specified by the user (e.g., -m);\n  * found lying about in MERGE_MSG;\n  * picked up from the HEAD commit (for --amend); or\n  * empty.\n\nChoosing between MERGE_MSG and --amend is difficult; indeed, they\nprobably ought to be mutually exclusive.  But both should obviously win\nover an empty initial message, and (I think) just as obviously lose to\nan explicit message -- after all, the purpose of --amend is primarily to\nreplace the current HEAD commit, not to fill in a default message.\n\n-- [mdw]\n"},{"id":"32649","messageId":"7vodom9284.fsf@assigned-by-dhcp.cox.net","threadId":"6511","inReplyTo":"slrnerh8la.7v0.mdw@metalzone.distorted.org.uk","subject":"Re: [PATCH] Documentation: --amend cannot be combined with -c/-C/-F.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-25T22:21:47Z","receivedAt":"2007-01-25T22:21:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Mark Wooding <mdw@distorted.org.uk> writes:\n\n> Currently -c (copy some other commit message, and then edit it) is\n> considered to be a `force message to be...' kind of option, like the\n> others I've listed above.\n>\n> So, for some reason, is --amend.  This last is really annoying.\n\nI think the mindset is a bit different.  The -C/-c options are\nabout the latter half of cherry-picking.  The user asks \"reuse\nthe message from an existing commit so that I do not have to\ntype\", or \"I could reuse the original log message almost as-is,\nbut I am using the change in a slightly different context from\nthe original commit (and that is why cherry-pick did not finish\nby itself and you need to run git-commit after fixing up), so I\nwould need to talk a bit about what I did in the fix-up in the\nlog message\".  Both are useful.\n\nAmend is conflated -- you are amending what you did, either\nperhaps you found a small typo in the code in which case the\ndifference between what is being amended and what will be\ncommitted may only be the tree and you would want to re-use an\nexisting message as-is, or you found a small typo in the log\nmessage in which case there won't be any difference in the trees\nbut you do want to spellfix the log message, or you may be\nfixing both.\n\nWe happen default to the edit behaviour for no particular\nreason, other than \"because :q or C-x # are cheap\".\n\nUnfortunatly there is no good default for this case -- fixing\ntree and fixing message are both almost equally often used in\nthe real world, so changing --amend not to let you edit by\ndefault and adding --edit option would inconvenience other use\ncase.\n\nAdding --no-edit option is not very nice either.  It's almost as\ncumbersome to type as \"EDITOR=:\".\n\nWhat you want might be an --amend-tree option; it would be to\nthe --amend option what the -C (--reuse-message) option is to\nthe -c (--reedit-message).\n"},{"id":"32651","messageId":"20070125223805.GA13677@moooo.ath.cx","threadId":"6511","inReplyTo":"7vodom9284.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Documentation: --amend cannot be combined with -c/-C/-F.","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2007-01-25T22:38:05Z","receivedAt":"2007-01-25T22:38:05Z","isPatch":true,"sender":{"key":"matled@gmx.net","avatar":null},"body":"Junio C Hamano <junkio@cox.net> wrote:\n> What you want might be an --amend-tree option; it would be to\n> the --amend option what the -C (--reuse-message) option is to\n> the -c (--reedit-message).\nWhy not add --amend-tree and --amend-message (--amend is both in\none)?.  This would allow to amend the tree easily without changing the\nmessage and editing the message without caring for the current state\nof the index.\n"}]}