{"thread":{"id":"31999","subject":"Wishlist: git commit --no-edit","startedAt":"2012-11-02T09:26:22Z","lastAt":"2012-11-02T12:45:22Z","messageCount":9,"participants":["Niels Möller","Matthieu Moy","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"202401","messageId":"nntxt8ice9.fsf@stalhein.lysator.liu.se","threadId":"31999","inReplyTo":null,"subject":"Wishlist: git commit --no-edit","fromName":"Niels Möller","fromEmail":"nisse@lysator.liu.se","sentAt":"2012-11-02T09:26:22Z","receivedAt":"2012-11-02T09:26:22Z","isPatch":false,"sender":{"key":"nisse@lysator.liu.se","avatar":null},"body":"I'd like to have a git commit option which is the opposite of --edit, to\nuse the selected commit message as is, without invoking any editor.\n\nMain use case I see would be\n\n  git commit --amend --no-edit\n\n(say you fix a typo in the previous commit which doesn't affect the\ncommit message). Today, one can get the same effect more clumsily as\n\n  EDITOR=touch git commit --amend\n\nOr maybe as\n\n  git commit --amend -C HEAD\n\nBut I'd really prefer a --no-edit option over those alternatives. And it\nmight be useful also in combination with other options, e.g., it would\nmake the -C option equivalent to -c --no-edit, if I understand it\ncorrectly.\n\nRegards,\n/Niels\n\n-- \nNiels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.\nInternet email is subject to wholesale government surveillance.\n"},{"id":"202403","messageId":"vpqfw4sgx33.fsf@grenoble-inp.fr","threadId":"31999","inReplyTo":"nntxt8ice9.fsf@stalhein.lysator.liu.se","subject":"Re: Wishlist: git commit --no-edit","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-11-02T09:42:24Z","receivedAt":"2012-11-02T09:42:24Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"nisse@lysator.liu.se (Niels Möller) writes:\n\n> I'd like to have a git commit option which is the opposite of --edit, to\n> use the selected commit message as is, without invoking any editor.\n>\n> Main use case I see would be\n>\n>   git commit --amend --no-edit\n\nErr, isn't this already working? (maybe your version of Git is too old,\nbut my 1.7.9.5 does this at least)\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"202406","messageId":"20121102095954.GB30221@sigill.intra.peff.net","threadId":"31999","inReplyTo":"vpqfw4sgx33.fsf@grenoble-inp.fr","subject":"Re: Wishlist: git commit --no-edit","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-11-02T09:59:54Z","receivedAt":"2012-11-02T09:59:54Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Nov 02, 2012 at 10:42:24AM +0100, Matthieu Moy wrote:\n\n> nisse@lysator.liu.se (Niels Möller) writes:\n> \n> > I'd like to have a git commit option which is the opposite of --edit, to\n> > use the selected commit message as is, without invoking any editor.\n> >\n> > Main use case I see would be\n> >\n> >   git commit --amend --no-edit\n> \n> Err, isn't this already working? (maybe your version of Git is too old,\n> but my 1.7.9.5 does this at least)\n\nYup, should be working since 1.7.9.\n\n  $ git tag --contains ':/commit: honour --no-edit' |\n    sort -V |\n    head -1\n  v1.7.9\n\n-Peff\n"},{"id":"202408","messageId":"nnpq3wiaha.fsf@stalhein.lysator.liu.se","threadId":"31999","inReplyTo":"vpqfw4sgx33.fsf@grenoble-inp.fr","subject":"Re: Wishlist: git commit --no-edit","fromName":"Niels Möller","fromEmail":"nisse@lysator.liu.se","sentAt":"2012-11-02T10:07:45Z","receivedAt":"2012-11-02T10:07:45Z","isPatch":false,"sender":{"key":"nisse@lysator.liu.se","avatar":null},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Err, isn't this already working? (maybe your version of Git is too old,\n> but my 1.7.9.5 does this at least)\n\nIt may be that I'm confused.\n\nIt doesn't work in the version I have (1.7.2.5, debian packaged).\n\nAnd then I also had a quick look in the source code (of a fresh pull\nfrom https://github.com/git/git.git). In builtin/commit.c, I didn't see\nany no-edit flag (but I maybe it's in the OPT_BOOL magic (which is\ndifferent from OPT_BOOLEAN?)).\n\nAnd it's also not mentioned in Documentation/git-commit.txt or on\nhttp://kernel.org/pub/software/scm/git/docs/git-commit.html.\n\nIf commit --no-edit does work in recent versions, then all is fine,\nexcept possibly the documentation of it. Thanks.\n\nRegards,\n/Niels\n\n-- \nNiels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.\nInternet email is subject to wholesale government surveillance.\n"},{"id":"202409","messageId":"1351852770-13897-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"31999","inReplyTo":"nnpq3wiaha.fsf@stalhein.lysator.liu.se","subject":"[PATCH] Document 'git commit --no-edit' explicitly","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-11-02T10:39:30Z","receivedAt":"2012-11-02T10:39:30Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\nI was tempted to merge the paragraph with --edit::, but I thought this\nmay add confusion. The use-cases for --edit and --no-edit are really\ndifferent so I went for a separate paragraph, right below the --edit one.\n\n Documentation/git-commit.txt | 5 +++++\n 1 file changed, 5 insertions(+)\n\ndiff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt\nindex 3acf2e7..44b4347 100644\n--- a/Documentation/git-commit.txt\n+++ b/Documentation/git-commit.txt\n@@ -188,6 +188,11 @@ OPTIONS\n \tcommit log message unmodified.  This option lets you\n \tfurther edit the message taken from these sources.\n \n+--no-edit::\n+\tUse the selected commit message without launching an editor.\n+\tFor example, `git commit --amend --no-edit` amends a commit\n+\twithout changing its commit message.\n+\n --amend::\n \tUsed to amend the tip of the current branch. Prepare the tree\n \tobject you would want to replace the latest commit as usual\n-- \n1.8.0.319.g8abfee4\n"},{"id":"202411","messageId":"nnlieki6xs.fsf@stalhein.lysator.liu.se","threadId":"31999","inReplyTo":"1351852770-13897-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH] Document 'git commit --no-edit' explicitly","fromName":"Niels Möller","fromEmail":"nisse@lysator.liu.se","sentAt":"2012-11-02T11:24:15Z","receivedAt":"2012-11-02T11:24:15Z","isPatch":true,"sender":{"key":"nisse@lysator.liu.se","avatar":null},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n\n> +--no-edit::\n> +\tUse the selected commit message without launching an editor.\n> +\tFor example, `git commit --amend --no-edit` amends a commit\n> +\twithout changing its commit message.\n\nLooks clear enough to me. Thanks for fixing.\n\nAre -c --no-edit and -C really equivalent in all cases? If so, maybe you\nwant to say that in the documentation for -C. (And if not, maybe they\n*ought* to be equivalent).\n\nRegards,\n/Niels\n\n-- \nNiels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.\nInternet email is subject to wholesale government surveillance.\n"},{"id":"202412","messageId":"vpqip9ofdjp.fsf@grenoble-inp.fr","threadId":"31999","inReplyTo":"nnlieki6xs.fsf@stalhein.lysator.liu.se","subject":"Re: [PATCH] Document 'git commit --no-edit' explicitly","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-11-02T11:29:46Z","receivedAt":"2012-11-02T11:29:46Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"nisse@lysator.liu.se (Niels Möller) writes:\n\n> Matthieu Moy <Matthieu.Moy@imag.fr> writes:\n>\n>> +--no-edit::\n>> +\tUse the selected commit message without launching an editor.\n>> +\tFor example, `git commit --amend --no-edit` amends a commit\n>> +\twithout changing its commit message.\n>\n> Looks clear enough to me. Thanks for fixing.\n>\n> Are -c --no-edit and -C really equivalent in all cases?\n\nI guess so, but I didn't check.\n\n> If so, maybe you want to say that in the documentation for -C.\n\nI don't think we should target exhaustivity in the documentation, so I'm\nnot in favor of *adding* it. But maybe we should replace the doc with\nstg like:\n\n-c <commit>::\n--reedit-message=<commit>::\n\tLike '-C --edit'.\n\n(it could even make sense to deprecate one of -C/-c)\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"202413","messageId":"20121102115335.GA2598@sigill.intra.peff.net","threadId":"31999","inReplyTo":"1351852770-13897-1-git-send-email-Matthieu.Moy@imag.fr","subject":"Re: [PATCH] Document 'git commit --no-edit' explicitly","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-11-02T11:53:35Z","receivedAt":"2012-11-02T11:53:35Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Nov 02, 2012 at 11:39:30AM +0100, Matthieu Moy wrote:\n\n> I was tempted to merge the paragraph with --edit::, but I thought this\n> may add confusion. The use-cases for --edit and --no-edit are really\n> different so I went for a separate paragraph, right below the --edit one.\n\nYeah, usually I think it would be better to keep the positive and\nnegative forms together, but the way you have done it does seem a lot\nmore clear to me. I think it is because the default flips based on other\noptions. So you would be stuck writing something like:\n\n  -e, --edit::\n          Edit the commit message using `$EDITOR`. This is the default\n          unless the `-F`, `-m`, or `-C` options are used; in those\n          cases, `-e` or `--edit` can be used to invoke the editor.\n          Likewise, `--no-edit` can be used to suppress the editor when\n          using an existing commit message. For example, `git commit\n          --amend --no-edit` amends a commit without changing its commit\n          message.\n\nYour split reads much better, IMHO.\n\nThanks.\n\n-Peff\n"},{"id":"202415","messageId":"20121102124522.GA6817@sigill.intra.peff.net","threadId":"31999","inReplyTo":"CACnwZYe-za3Q0qvkfQ=qatB1-8eLUFA6ZzfS41yeqrV=8rVzGA@mail.gmail.com","subject":"Re: Wishlist: git commit --no-edit","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-11-02T12:45:22Z","receivedAt":"2012-11-02T12:45:22Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"[+cc git@vger; please keep discussion on list]\n\nOn Fri, Nov 02, 2012 at 10:37:27AM -0200, Thiago Farina wrote:\n\n> >> >   git commit --amend --no-edit\n> [...]\n> > Yup, should be working since 1.7.9.\n> [...]\n> I doesn't appear in the help either:\n> \n> $ git version\n> git version 1.8.0.rc2\n> \n> $ git commit -h 2>&1 | grep edit\n>     -c, --reedit-message <commit>\n>                           reuse and edit message from specified commit\n>     -e, --edit            force edit of commit\n\nYeah, parse_options doesn't advertise negative forms of boolean options,\nas they are implied. I don't think it's a big deal, especially now that\nit is covered in more detail in the manpage.\n\nI think changing it would probably involve adding \"--no-edit\" as a\nseparate entry in the options struct.\n\n-Peff\n"}]}