{"thread":{"id":"28610","subject":"Prompt for merge message?","startedAt":"2011-10-06T17:49:02Z","lastAt":"2011-10-07T03:07:31Z","messageCount":10,"participants":["Todd A. Jacobs","Jacob Helwig","in-gitvger@baka.org","Stephen Bash","Andreas Krey","Junio C Hamano","Shawn Pearce"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"177079","messageId":"6eb7acc7-f4be-4b90-a2fa-a0c91ed9a5a8@t11g2000yqk.googlegroups.com","threadId":"28610","inReplyTo":null,"subject":"Prompt for merge message?","fromName":"Todd A. Jacobs","fromEmail":"nospam+listmail@codegnome.org","sentAt":"2011-10-06T17:49:02Z","receivedAt":"2011-10-06T17:49:02Z","isPatch":false,"sender":{"key":"nospam+listmail@codegnome.org","avatar":null},"body":"I often find myself using \"--no-ff -m foo\" for merging short-lived\nbranches, because the merge commit usually needs to say something\nabout having finished a feature rather than referring to a branch that\nwill be deleted shortly anyway. However, it's a little annoying to\nhave to always write the commit message on the command-line,\nespecially in cases where a more expository multi-line message would\nbe useful.\n\nIs there currently a way to get git to prompt for the merge message,\nrather than using the default or requiring the -m flag? If not, isn't\nthis a common-enough use case to have that ability added to the merge\nfunction?\n"},{"id":"177088","messageId":"20111006182534.GA13628@vfa-6h","threadId":"28610","inReplyTo":"6eb7acc7-f4be-4b90-a2fa-a0c91ed9a5a8@t11g2000yqk.googlegroups.com","subject":"Re: Prompt for merge message?","fromName":"Jacob Helwig","fromEmail":"jacob@technosorcery.net","sentAt":"2011-10-06T18:25:34Z","receivedAt":"2011-10-06T18:25:34Z","isPatch":false,"sender":{"key":"jacob@technosorcery.net","avatar":"https://gravatar.com/avatar/6116efbbb00b1c0268cd76ce802f2caefdd52245a729e5ad3cf09fd3cf778002?d=mp&s=160"},"body":"On Thu, 06 Oct 2011 10:49:02 -0700, Todd A. Jacobs wrote:\n> \n> I often find myself using \"--no-ff -m foo\" for merging short-lived\n> branches, because the merge commit usually needs to say something\n> about having finished a feature rather than referring to a branch that\n> will be deleted shortly anyway. However, it's a little annoying to\n> have to always write the commit message on the command-line,\n> especially in cases where a more expository multi-line message would\n> be useful.\n> \n> Is there currently a way to get git to prompt for the merge message,\n> rather than using the default or requiring the -m flag? If not, isn't\n> this a common-enough use case to have that ability added to the merge\n> function?\n\n\"git merge --no-ff --no-commit branch_foo && git commit\" ?\n\nThough it would be handy to have a \"stop and let me edit the merge\ncommit message\" flag on git merge itself.\n\n-- \nJacob Helwig\nhttp://about.me/jhelwig\n"},{"id":"177095","messageId":"201110061851.p96Ipfui016139@no.baka.org","threadId":"28610","inReplyTo":"20111006182534.GA13628@vfa-6h","subject":"Re: Prompt for merge message?","fromName":"","fromEmail":"in-gitvger@baka.org","sentAt":"2011-10-06T18:51:41Z","receivedAt":"2011-10-06T18:51:41Z","isPatch":false,"sender":{"key":"in-gitvger@baka.org","avatar":null},"body":"\nIn message <20111006182534.GA13628@vfa-6h>, Jacob Helwig writes:\n\n    On Thu, 06 Oct 2011 10:49:02 -0700, Todd A. Jacobs wrote:\n\n    > I often find myself using \"--no-ff -m foo\" for merging short-lived\n    > branches, because the merge commit usually needs to say something\n    > about having finished a feature rather than referring to a branch that\n    > will be deleted shortly anyway. However, it's a little annoying to\n    > have to always write the commit message on the command-line,\n    > especially in cases where a more expository multi-line message would\n    > be useful.\n\n    \"git merge --no-ff --no-commit branch_foo && git commit\" ?\n\nWhile not ideal, you can use a multi-line message on the command line.\nI do it all of the time.  Popping up an editor like in the separated\nworkflow is more user friendly.\n\n----------------------------------------------------------------------\ngit merge --no-ff -m \"My feature is very complex\n\nIt requires multiple lines to explain.\n\nOr perhaps I am too verbose.\" branch_foo\n----------------------------------------------------------------------\n\n\t\t\t\t\t-Seth Robertson\n"},{"id":"177098","messageId":"21983420.46542.1317932138649.JavaMail.root@mail.hq.genarts.com","threadId":"28610","inReplyTo":"201110061851.p96Ipfui016139@no.baka.org","subject":"Re: Prompt for merge message?","fromName":"Stephen Bash","fromEmail":"bash@genarts.com","sentAt":"2011-10-06T20:15:38Z","receivedAt":"2011-10-06T20:15:38Z","isPatch":false,"sender":{"key":"bash@genarts.com","avatar":null},"body":"----- Original Message -----\n> From: in-gitvger@baka.org\n> Sent: Thursday, October 6, 2011 2:51:41 PM\n> Subject: Re: Prompt for merge message?\n>\n> In message <20111006182534.GA13628@vfa-6h>, Jacob Helwig writes:\n> \n> On Thu, 06 Oct 2011 10:49:02 -0700, Todd A. Jacobs wrote:\n> \n> > I often find myself using \"--no-ff -m foo\" for merging short-lived\n> > branches, because the merge commit usually needs to say something\n> > about having finished a feature rather than referring to a branch\n> > that\n> > will be deleted shortly anyway. However, it's a little annoying to\n> > have to always write the commit message on the command-line,\n> > especially in cases where a more expository multi-line message would\n> > be useful.\n> \n> \"git merge --no-ff --no-commit branch_foo && git commit\" ?\n> \n> While not ideal, you can use a multi-line message on the command line.\n> I do it all of the time. Popping up an editor like in the separated\n> workflow is more user friendly.\n> \n> ----------------------------------------------------------------------\n> git merge --no-ff -m \"My feature is very complex\n> \n> It requires multiple lines to explain.\n> \n> Or perhaps I am too verbose.\" branch_foo\n> ----------------------------------------------------------------------\n\nAnd not so helpful if you want to use the --log option to pre-populate the merge message (which I often run into).\n\nThanks,\nStephen\n"},{"id":"177099","messageId":"20111006201907.GA27744@inner.h.iocl.org","threadId":"28610","inReplyTo":"20111006182534.GA13628@vfa-6h","subject":"Re: Prompt for merge message?","fromName":"Andreas Krey","fromEmail":"a.krey@gmx.de","sentAt":"2011-10-06T20:19:07Z","receivedAt":"2011-10-06T20:19:07Z","isPatch":false,"sender":{"key":"a.krey@gmx.de","avatar":"https://avatars.githubusercontent.com/u/37810?v=4"},"body":"On Thu, 06 Oct 2011 11:25:34 +0000, Jacob Helwig wrote:\n> \"git merge --no-ff --no-commit branch_foo && git commit\" ?\n\n\"git merge --no-ff branch_foo && git commit --amend\"\n\nAndreas\n"},{"id":"177118","messageId":"7vsjn5ye0x.fsf@alter.siamese.dyndns.org","threadId":"28610","inReplyTo":"6eb7acc7-f4be-4b90-a2fa-a0c91ed9a5a8@t11g2000yqk.googlegroups.com","subject":"Re: Prompt for merge message?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-10-06T22:02:38Z","receivedAt":"2011-10-06T22:02:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Todd A. Jacobs\" <nospam+listmail@codegnome.org> writes:\n\n> I often find myself using \"--no-ff -m foo\" for merging short-lived\n> branches, because the merge commit usually needs to say something\n> about having finished a feature rather than referring to a branch that\n> will be deleted shortly anyway....\n> ... Is there currently a way to get git to prompt for the merge message,\n> rather than using the default or requiring the -m flag? If not, isn't\n> this a common-enough use case to have that ability added to the merge\n> function?\n\nOthers commented on the current practices and gave their own useful tips\nalready, but an additional hint is to name your branch more sensibly, so\nthat you do not feel it is useless to record it in the history.\n\nAs to a real longer-term solution, I wouldn't mind a patch that teaches\n\"git merge\" an \"-e\" option just like \"git commit\" has.\n\n    $ git commit -m \"Finish frotz feature\" -e -a\n    ... editor opens with the first line filled already here ...\n\nis something I find myself using fairly often.\n\nThanks.\n\n[offtopic: It is annoying that my MUA warns me\n\n    \"nospam+listmail@domain\" may be bogus; do you really want to send?\n\nCould you do something about it please?]\n"},{"id":"177120","messageId":"CAJo=hJvFytscxyx2z+Fdw9E1DS02wSXgoE3SHkxKq2OYOMQHgQ@mail.gmail.com","threadId":"28610","inReplyTo":"7vsjn5ye0x.fsf@alter.siamese.dyndns.org","subject":"Re: Prompt for merge message?","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2011-10-06T22:09:26Z","receivedAt":"2011-10-06T22:09:26Z","isPatch":false,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"On Thu, Oct 6, 2011 at 15:02, Junio C Hamano <gitster@pobox.com> wrote:\n> \"Todd A. Jacobs\" <nospam+listmail@codegnome.org> writes:\n>\n>> I often find myself using \"--no-ff -m foo\" for merging short-lived\n>> branches, because the merge commit usually needs to say something\n>> about having finished a feature rather than referring to a branch that\n>> will be deleted shortly anyway....\n>> ... Is there currently a way to get git to prompt for the merge message,\n>> rather than using the default or requiring the -m flag? If not, isn't\n>> this a common-enough use case to have that ability added to the merge\n>> function?\n>\n> Others commented on the current practices and gave their own useful tips\n> already, but an additional hint is to name your branch more sensibly, so\n> that you do not feel it is useless to record it in the history.\n>\n> As to a real longer-term solution, I wouldn't mind a patch that teaches\n> \"git merge\" an \"-e\" option just like \"git commit\" has.\n>\n>    $ git commit -m \"Finish frotz feature\" -e -a\n>    ... editor opens with the first line filled already here ...\n>\n> is something I find myself using fairly often.\n\nWhat about adding something like:\n\n  if (isatty(0) && isatty(1) && isatty(2)) {\n    do_interactive_commit();\n  }\n\nto git merge? I know the reason we don't want to do it all of the time\nis because git merge is already used in a lot of scripts. But how many\nof those are running with an active terminal on all 3 standard fds\nwhen it runs git merge?\n"},{"id":"177125","messageId":"7v8voxyakg.fsf@alter.siamese.dyndns.org","threadId":"28610","inReplyTo":"CAJo=hJvFytscxyx2z+Fdw9E1DS02wSXgoE3SHkxKq2OYOMQHgQ@mail.gmail.com","subject":"Re: Prompt for merge message?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-10-06T23:17:19Z","receivedAt":"2011-10-06T23:17:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Shawn Pearce <spearce@spearce.org> writes:\n\n> to git merge? I know the reason we don't want to do it all of the time\n> is because git merge is already used in a lot of scripts. But how many\n> of those are running with an active terminal on all 3 standard fds\n> when it runs git merge?\n\nNinety four?\n\n$ git grep -l 'git merge' -- 't/t[0-9][0-9][0-9][0-9]-*.sh' | wc -l\n"},{"id":"177131","messageId":"403e37d1-bdd3-46fc-9a9a-e8aab3a2d3ba@f6g2000vbm.googlegroups.com","threadId":"28610","inReplyTo":"7vsjn5ye0x.fsf@alter.siamese.dyndns.org","subject":"Re: Prompt for merge message?","fromName":"Todd A. Jacobs","fromEmail":"nospam+listmail@codegnome.org","sentAt":"2011-10-07T01:15:11Z","receivedAt":"2011-10-07T01:15:11Z","isPatch":false,"sender":{"key":"nospam+listmail@codegnome.org","avatar":null},"body":"On Oct 6, 6:02 pm, Junio C Hamano <gits...@pobox.com> wrote:\n> Others commented on the current practices and gave their own useful tips\n> already, but an additional hint is to name your branch more sensibly, so\n> that you do not feel it is useless to record it in the history.\n\nWhile I can see your point of view, I don't think that it fits every\nwork-flow. In particular, if you want to maintain a linear history on\nthe master branch but record the completion of a feature as a commit\nobject separate from the last patch in a series, you have two choices\nat the moment:\n\n1. A fast-forward merge, followed by an empty commit with --allow-\nempty. However, the empty commit seems to get discarded on merges, or\nfinds other ways to disappear outside of the feature branch on which\nit was created. It probably isn't a bug, but it can be very surprising\nto create an empty commit object on a feature branch, and then have it\ndisappear when you merge to master.\n\n2. A merge commit with an explicit merge message, which is what we've\nbeen talking about in this thread.\n\nThe point of the exercise is (mostly) to integrate with issue trackers\nlike Pivotal or GitHub, where a commit with certain keywords can\nintegrate with ticket history. But, IMHO, it doesn't necessarily make\nsense that any given patch closes a ticket; sometimes they do, but\nsometimes I really prefer a standalone commit to essentially say \"and\nnow the ticket is really, really done.\"\n\nThe fact that there have been so many useful suggestions about how to\nwork around this issue seems to imply that it isn't a low bus-factor\nissue. My personal vote is for your suggestion of an [-e|--edit] flag\nfor the merge; that would make it (mostly) consistent with commit's\nbehavior. I can certainly see that in the common case the default\nmerge message is the right thing to do, but I really do feel that\nthere ought to be *some* flag to allow a visual editor to edit the\nmerge message without having to amend the merge commit or merge\nwithout a commit just so that the next commit will invoke the editor.\n\nUltimately, I guess what I'm really agitating for is just an editor\noption for merge commits. If you take work-flow out of the equation,\nisn't there still a case for easily-editable merge messages?\n"},{"id":"177132","messageId":"7vy5wxwlcc.fsf@alter.siamese.dyndns.org","threadId":"28610","inReplyTo":"403e37d1-bdd3-46fc-9a9a-e8aab3a2d3ba@f6g2000vbm.googlegroups.com","subject":"Re: Prompt for merge message?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-10-07T03:07:31Z","receivedAt":"2011-10-07T03:07:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Todd A. Jacobs\" <nospam+listmail@codegnome.org> writes:\n\n> On Oct 6, 6:02 pm, Junio C Hamano <gits...@pobox.com> wrote:\n>> Others commented on the current practices and gave their own useful tips\n>> already, but an additional hint is to name your branch more sensibly, so\n>> that you do not feel it is useless to record it in the history.\n> ...\n> Ultimately, I guess what I'm really agitating for is just an editor\n> option for merge commits. If you take work-flow out of the equation,\n> isn't there still a case for easily-editable merge messages?\n\nI do not see any reason for you to be agitated. All you need to do is to\nread beyond what you chose to quote from my message, read that part before\nomitting from your quote ;-).\n"}]}