Created
October 29, 2019 21:06
-
-
Save lisawolderiksen/f9747a3ae1e58e9daa7d176ab98f1bad to your computer and use it in GitHub Desktop.
Revisions
-
lisawolderiksen revised this gist
Oct 29, 2019 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ # Adding co-authors to Git commits How do you share credit for a new or altered piece of code when one person commits the change in a pair programming or mob programming session? And when you have questions about a particular change, how can you see in Git who has been working on that change, besides the committer? *You add co-autors to your commits.* This gist contains information on how to do that, so that the Git commit message contains a list of co-authors, and all co-autors for a commit are automatically listed in GitHubs web UI. GitHub has some info on specifying co-authors [here](https://help.github.com/en/github/committing-changes-to-your-project/creating-a-commit-with-multiple-authors). This is good info, pretty straightforward. The gist of it (pun intended) is to include at least one blank line and then a line for each co-author like so `Co-authored-by: name <[email protected]>` at the very end of your commit message. -
lisawolderiksen revised this gist
Oct 29, 2019 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,9 @@ GitHub has some info on specifying co-authors [here](https://help.github.com/en/ GitHub's recipe tells you [how to find the right e-mail address to use](https://help.github.com/en/github/committing-changes-to-your-project/creating-a-commit-with-multiple-authors#required-co-author-information) (the GitHub-provided `no-reply` address if appropriate), as well as [how to create co-authored commits using GitHub Desktop](https://help.github.com/en/github/committing-changes-to-your-project/creating-a-commit-with-multiple-authors#creating-co-authored-commits-using-github-desktop), [how to create co-authored commits when using the web editor on GitHub](https://help.github.com/en/github/committing-changes-to-your-project/creating-a-commit-with-multiple-authors#creating-co-authored-commits-on-github), and [how to create co-authored commits on the command line](https://help.github.com/en/github/committing-changes-to-your-project/creating-a-commit-with-multiple-authors#creating-co-authored-commits-on-the-command-line). The latter is most relevant for our team. The recipe created by GitHub is a good one. Use it! :) ...But there is one thing which might be a source of confusion - the number of empty lines required between the end of the commit description and the co-author section. The GitHub recipe includes the following tip: >If you're using a text editor on the command line to type your commit message, ensure there are *two lines* between the end of your commit description and the `Co-authored-by:` commit trailer. The thing is that when I do this, no matter how many blank lines I put between the co-author info and the previous part of the commit message in the editor, the resulting *actual* commit message contains only *one* empty line there. But it's OK, the actual requirement seems to be *at least one empty line (i.e. two "newline" characters) between the description and the co-author section*. So there's no need to worry and do `git commit --amend` to fix the commit message like I did, the end result displayed in the GitHub UI is the same as long as there is one empty line before the co-author section. :) To avoid having to remember how to do this every time I make a commit during a pair/mob programming session, I added this info to my commit message template, which is described [here](https://gist.github.com/lisawolderiksen/a7b99d94c92c6671181611be1641c733). So when I do `git commit` and my editor opens, I have all the info I need to write a good commit message - including how to credit co-authors. :) -
lisawolderiksen created this gist
Oct 29, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ # Adding co-authors to Git commits How do you share credit for a new or altered piece of code when one person commits the change after a pair programming or mob programming session? And when you have questions about a particular change, how can you see in Git who has been working on that change, besides the committer? *You add co-autors to your commits.* This gist contains information on how to do that, so that the Git commit message contains a list of co-authors, and all co-autors for a commit are automatically listed in GitHubs web UI. GitHub has some info on specifying co-authors [here](https://help.github.com/en/github/committing-changes-to-your-project/creating-a-commit-with-multiple-authors). This is good info, pretty straightforward. The gist of it (pun intended) is to include at least one blank line and then a line for each co-author like so `Co-authored-by: name <[email protected]>` at the very end of your commit message. GitHub's recipe tells you [how to find the right e-mail address to use](https://help.github.com/en/github/committing-changes-to-your-project/creating-a-commit-with-multiple-authors#required-co-author-information) (the GitHub-provided `no-reply` address if appropriate), as well as [how to create co-authored commits using GitHub Desktop](https://help.github.com/en/github/committing-changes-to-your-project/creating-a-commit-with-multiple-authors#creating-co-authored-commits-using-github-desktop), [how to create co-authored commits when using the web editor on GitHub](https://help.github.com/en/github/committing-changes-to-your-project/creating-a-commit-with-multiple-authors#creating-co-authored-commits-on-github), and [how to create co-authored commits on the command line](https://help.github.com/en/github/committing-changes-to-your-project/creating-a-commit-with-multiple-authors#creating-co-authored-commits-on-the-command-line). The latter is most relevant for our team. The recipe created by GitHub is a good one. Use it! :) ...But there is one thing which might be a source of confusion - the number of empty lines required between the end of the commit description and the co-author section. The GitHub recipe includes the following tip: >If you're using a text editor on the command line to type your commit message, ensure there are *two lines* between the end of your commit description and the `Co-authored-by:` commit trailer. The thing is that when I do this, no matter how many blank lines I put between the co-author info and the previous part of the commit message in the editor, the resulting *actual* commit message contains only *one* empty line there. But it's OK, the actual requirement seems to be *at least one empty line (i.e. two "newline" characters) between the description and the co-author section*. So there's no need to worry and do `git commit --amend` to fix the commit message like I did, the end result displayed in the GitHub UI is the same as long as there is one empty line before the co-author section. :) To avoid having to remember how to do this every time I make a commit during a pair/mob programming session, I added this info to my commit message template, which is described [here](https://gist.github.com/lisawolderiksen/a7b99d94c92c6671181611be1641c733). So when I do `git commit` and my editor opens, I have all the info I need to write a good commit message - including how to credit co-authors. :)