{"thread":{"id":"46302","subject":"Request for git merge --signoff","startedAt":"2017-07-01T15:24:46Z","lastAt":"2017-07-25T05:42:51Z","messageCount":6,"participants":["Dan Kohn","Junio C Hamano","Ævar Arnfjörð Bjarmason","Christian Couder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"323683","messageId":"CAHv71zK5SqbwrBFX=a8-DY9H3KT4FEyMgv__p2gZzNr0WUAPUw@mail.gmail.com","threadId":"46302","inReplyTo":null,"subject":"Request for git merge --signoff","fromName":"Dan Kohn","fromEmail":"dan@linuxfoundation.org","sentAt":"2017-07-01T15:24:20Z","receivedAt":"2017-07-01T15:24:46Z","isPatch":false,"sender":{"key":"dan@linuxfoundation.org","avatar":null},"body":"https://github.com/coreinfrastructure/best-practices-badge is a user\nof the https://github.com/probot/dco bot which checks that commits\nhave a signoff. The issue is that there is no `--signoff` option in\ngit for merge commits, which is a standard part of our workflow with\nfeature branches. Here is a workflow where we currently get stuck:\n\n```sh\n(master)$ git checkout -b feature-branch\n# make some changes\n(feature-branch)$ git commit -sam 'Adding features'\n# Changes have occurred on master so need to add them for easier merge\n(feature-branch)$ git fetch\n(feature-branch)$ git merge origin/master\n# Save default commit message\n(feature-branch)$ git push\n# This now fails the DCObot check because the merge commit is not signed.\n```\n\nThis alternative workflow works, but is obviously tedious:\n\n```sh\n# First 3 steps are the same\n(feature-branch)$ git merge origin/master\n# Save default commit message\n(feature-branch)$ git commit --amend -s\n# Commit message now has signoff line\n(feature-branch)$ git push\n# This now passes the DCObot check.\n```\n\nOr, I could manually add the Signoff line to the proposed git merge\ncommit message, which would allow me to skip the `--amend` step.\n\nCould you please add a `--signoff` option to `git merge`?\n\nProbot issue reference: https://github.com/probot/dco/issues/13\n--\nDan Kohn <mailto:dan@linuxfoundation.org>\nExecutive Director, Cloud Native Computing Foundation <https://cncf.io/>\ntel:+1-415-233-1000\n"},{"id":"323691","messageId":"xmqqbmp4nj9u.fsf@gitster.mtv.corp.google.com","threadId":"46302","inReplyTo":"CAHv71zK5SqbwrBFX=a8-DY9H3KT4FEyMgv__p2gZzNr0WUAPUw@mail.gmail.com","subject":"Re: Request for git merge --signoff","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-07-01T17:45:17Z","receivedAt":"2017-07-01T17:45:23Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dan Kohn <dan@linuxfoundation.org> writes:\n\n> This alternative workflow works, but is obviously tedious:\n>\n> ```sh\n> # First 3 steps are the same\n> (feature-branch)$ git merge origin/master\n> # Save default commit message\n> (feature-branch)$ git commit --amend -s\n> # Commit message now has signoff line\n> (feature-branch)$ git push\n> # This now passes the DCObot check.\n> ```\n>\n> Or, I could manually add the Signoff line to the proposed git merge\n> commit message, which would allow me to skip the `--amend` step.\n>\n> Could you please add a `--signoff` option to `git merge`?\n\nThe reason why we changed the default for \"git merge\" to start an\neditor at around v1.7.10 was because we wanted to encourage people\nto write log message that more meaningfully documents the change,\nand adding sign-off is probably in line with that.  \n\nI've done that \"commit --amend\" on a merge to tweak its message\nmyself number of times, but I have to admit that I never did so for\nsign-off, but why not? ;-)\n\n"},{"id":"323693","messageId":"CAHv71zJZfG3AGNL_J5KqYiut6AyyNdUyBG-sZ9aZ-zoGVdOr+w@mail.gmail.com","threadId":"46302","inReplyTo":"xmqqbmp4nj9u.fsf@gitster.mtv.corp.google.com","subject":"Re: Request for git merge --signoff","fromName":"Dan Kohn","fromEmail":"dan@linuxfoundation.org","sentAt":"2017-07-01T18:15:57Z","receivedAt":"2017-07-01T18:16:23Z","isPatch":false,"sender":{"key":"dan@linuxfoundation.org","avatar":null},"body":"On Sat, Jul 1, 2017 at 1:45 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Dan Kohn <dan@linuxfoundation.org> writes:\n\n>> Could you please add a `--signoff` option to `git merge`?\n\n> The reason why we changed the default for \"git merge\" to start an\n> editor at around v1.7.10 was because we wanted to encourage people\n> to write log message that more meaningfully documents the change,\n> and adding sign-off is probably in line with that.\n\n> I've done that \"commit --amend\" on a merge to tweak its message\n> myself number of times, but I have to admit that I never did so for\n> sign-off, but why not? ;-)\n\nI'm not opposed to starting the editor, although in the case of our\nworkflow there's not much more to say beyond \"Merged in master\". I\nwould just like the Sign-Off line to appear by default in the commit\nmessage if I do `git merge origin/master --signoff`. I know it seems\ntrivial, but many GitHub users aren't familiar with the exact header\nsyntax to use, as they're used to just doing `git commit -sam 'New\nFeature'`.\n\nSeparately, I just came back from Beijing where Linus spoke at LC3\n<https://www.lfasiallc.com/linuxcon-containercon-cloudopen-china>. He\nwas asked about git and explained that he had largely bowed out of any\ndevelopment after the first few months and credited your stewardship.\nEven if you turn down my request for a new flag here, thanks for the\namazing project!\n--\nDan Kohn <mailto:dan@linuxfoundation.org>\nExecutive Director, Cloud Native Computing Foundation <https://cncf.io/>\ntel:+1-415-233-1000\n"},{"id":"323729","messageId":"xmqq7ezroqfa.fsf@gitster.mtv.corp.google.com","threadId":"46302","inReplyTo":"CAHv71zJZfG3AGNL_J5KqYiut6AyyNdUyBG-sZ9aZ-zoGVdOr+w@mail.gmail.com","subject":"Re: Request for git merge --signoff","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-07-01T20:25:29Z","receivedAt":"2017-07-01T20:25:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dan Kohn <dan@linuxfoundation.org> writes:\n\n> On Sat, Jul 1, 2017 at 1:45 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Dan Kohn <dan@linuxfoundation.org> writes:\n>\n>>> Could you please add a `--signoff` option to `git merge`?\n>\n>> The reason why we changed the default for \"git merge\" to start an\n>> editor at around v1.7.10 was because we wanted to encourage people\n>> to write log message that more meaningfully documents the change,\n>> and adding sign-off is probably in line with that.\n>\n>> I've done that \"commit --amend\" on a merge to tweak its message\n>> myself number of times, but I have to admit that I never did so for\n>> sign-off, but why not? ;-)\n>\n> I'm not opposed to starting the editor, although ...\n> ...\n> Even if you turn down my request for a new flag here,...\n\nWas I a bit too oblique?  I said that do think \"merge --signoff\" is\nin line with the latest philosophy, i.e. not rejecting the idea of\nadd such an option.  IOW, patches welcome (either from you or other\npeople).\n\n"},{"id":"323738","messageId":"87fueferd4.fsf@gmail.com","threadId":"46302","inReplyTo":"CAHv71zK5SqbwrBFX=a8-DY9H3KT4FEyMgv__p2gZzNr0WUAPUw@mail.gmail.com","subject":"Re: Request for git merge --signoff","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-07-01T22:15:19Z","receivedAt":"2017-07-01T22:15:28Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Sat, Jul 01 2017, Dan Kohn jotted:\n\n> https://github.com/coreinfrastructure/best-practices-badge is a user\n> of the https://github.com/probot/dco bot which checks that commits\n> have a signoff. The issue is that there is no `--signoff` option in\n> git for merge commits.\n\nI think it's fine to add such a feature, but it seems like an obvious\nbug to me in such a bot[1] that it's enforcing the DCO on merge commits.\n\nThe entire point of the DCO is to certify that you have the rights to\nsubmit the patch etc., it's quite dubious to be applying that to merge\ncommits which contain no original work (most of the time, although of\ncourse a merge commit can have significant conflict resolution).\n\nSo yeah, it would make sense to have a --signoff option, especially to\nuse when the merge actually does contain original work, but your stated\nreason for wanting this just seems like an easily solved bug in the bot:\nExclude those commits that have no patch contents.\n\n1. https://github.com/probot/dco/\n"},{"id":"325026","messageId":"CAP8UFD0KoamG88x-vWXPWT-pv8=f-v+fxOKH1=B9NrZrZhTm=g@mail.gmail.com","threadId":"46302","inReplyTo":"CAHv71zK5SqbwrBFX=a8-DY9H3KT4FEyMgv__p2gZzNr0WUAPUw@mail.gmail.com","subject":"Re: Request for git merge --signoff","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2017-07-25T05:42:45Z","receivedAt":"2017-07-25T05:42:51Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Sat, Jul 1, 2017 at 5:24 PM, Dan Kohn <dan@linuxfoundation.org> wrote:\n> https://github.com/coreinfrastructure/best-practices-badge is a user\n> of the https://github.com/probot/dco bot which checks that commits\n> have a signoff. The issue is that there is no `--signoff` option in\n> git for merge commits, which is a standard part of our workflow with\n> feature branches. Here is a workflow where we currently get stuck:\n\n[...]\n\n> Or, I could manually add the Signoff line to the proposed git merge\n> commit message, which would allow me to skip the `--amend` step.\n\nPerhaps you could use a prepare-commit-msg hook (or maybe a commit-msg\nhook) to automatically add your Signoff line to any commit message if\nit isn't there already.\n\nIn the prepare-commit-msg hook sample there is already commented out\ncode to do that:\n\nhttps://github.com/git/git/blob/master/templates/hooks--prepare-commit-msg.sample#L35-L36\n\nAlternatively you might want to use `git interpret-trailers` to do\nthat or more fancy trailer related things.\n\n> Could you please add a `--signoff` option to `git merge`?\n\nI am not opposed to add a `--signoff` option to `git merge`, but I\nthink the main plan to improve git in this area has been to first make\nit possible for git commands that can create commits to accept options\nlike \"--trailer 'Signed-off-by: Alice <alice@example.com>'\" and to\npass them to `git interpret-trailers` (or its underlying code).\n"}]}