Co-authoring Git commits Cassidy Williams on August 27, 2023 Sometimes when I'm pair programming (or if someone's been just super helpful to me), I want to be able to give another developer credit in a commit... Read full post Submit Preview Dismiss Collapse Expand Vesa Laakso Vesa Laakso Vesa Laakso Follow Co-founder / CTO @VenuuFinland. Open source maintainer https://github.com/webpack-contrib/webpack-bundle-analyzer Location Finland Work CTO at Venuu Joined Mar 23, 2018 • Aug 28 '23 Dropdown menu Copy link Hide This is neat! I am myself using the fancy --trailer flag that git commit also provides to do the same: git commit -m "The commit message" --trailer 'Co-authored-by: name <person@example.com>' Enter fullscreen mode Exit fullscreen mode I have even saved this to a git alias when I'm pair-programming more often so that I get the trailer appended automatically. For example: git config --global alias.commit-jane "commit --trailer 'Co-authored-by: Jane Doe <jane.doe@example.com>'" Enter fullscreen mode Exit fullscreen mode Now git commit-jane allows me to commit with Jane in Co-authored-by :) Collapse Expand Oana Munteanu Oana Munteanu Oana Munteanu Follow Location London, UK Work Frontend Developer Joined Apr 30, 2020 • Aug 28 '23 Dropdown menu Copy link Hide Ah this is so cool! I'm totally saving this in my gist files. thanks for sharing this! Collapse Expand Visakh Vijayan Visakh Vijayan Visakh Vijayan Follow There is nothing else in this world that gives as much happiness as coding Email vjnvisakh@gmail.com Location Kolkata, West Bengal Education MCA Pronouns he/him/his Work Full Stack Developer at JTC Joined Sep 2, 2018 • Aug 27 '23 Dropdown menu Copy link Hide nice. Appreicating is fulfilling Collapse Expand Samar F. Jaffri Samar F. Jaffri Samar F. Jaffri Follow Software Engineer | GCP Certified: Cloud Digital Leader | GCP Certified: Associate Cloud Engineer | Silver Medalist 🥈 Education Sir Syed University of Engineering and Technology Pronouns She/her Work Software Engineer Joined Feb 24, 2023 • Aug 27 '23 Dropdown menu Copy link Hide Woa! This would be a great way of showing them that their time and effort is valued. Thanks for sharing Cassidy! Collapse Expand Chirag Aggarwal Chirag Aggarwal Chirag Aggarwal Follow Platform Engineer @Appwrite Email chiragaggarwal5k@gmail.com Location India Education Bennett Univerisity Pronouns He/Him Work Platform Engineer Joined Nov 2, 2022 • Aug 30 '23 Dropdown menu Copy link Hide Github did this automatically when you commit a suggestion directly. Never know how to do this in command line. Really informative post ⭐️ Collapse Expand Alba Rincón Alba Rincón Alba Rincón Follow Email alba@rincon.me Location Barcelona Work Backend software engineer at Typeform Joined Oct 15, 2019 • Aug 29 '23 • Edited on Aug 29 • Edited Dropdown menu Copy link Hide Nice! 👏 I wrote a similar one some time ago, but to use it alongside git mob, which is a cool tool for pairing! dev.to/albarin/how-to-easily-add-c... Collapse Expand Oana Munteanu Oana Munteanu Oana Munteanu Follow Location London, UK Work Frontend Developer Joined Apr 30, 2020 • Aug 28 '23 Dropdown menu Copy link Hide ah I feel so bad that I didn't know about this until now and so happy that now I know this. Thanks for sharing this Cassidy! <3 Collapse Expand Grady Salzman Grady Salzman Grady Salzman Follow Software Engineer Extraordinaire @ Contenda Work Software Engineer at Contenda Joined Mar 21, 2023 • Aug 27 '23 Dropdown menu Copy link Hide This is really great, thanks for sharing how to do this! That Grady guy also seems really cool. Collapse Expand Cassidy Williams Cassidy Williams Cassidy Williams Follow bold and brash Location Chicago, IL Education B.S. Computer Science Pronouns she/her Work coding stuff Joined Feb 22, 2017 • Aug 28 '23 Dropdown menu Copy link Hide And sooooo smart Collapse Expand Brice Brice Brice Follow Joined Oct 7, 2020 • Sep 1 '23 • Edited on Sep 1 • Edited Dropdown menu Copy link Hide There is also more commit msg keywords convention.. for example : Closes: $BUGNUMBER Reviewed-by: Suggested-by: Tested-by: Thanks: msg (...) Enter fullscreen mode Exit fullscreen mode Cf. Src old wiki, and git trailer SO post Collapse Expand Jake Nelson Jake Nelson Jake Nelson Follow DevOps Tech Lead—AI and automation obsessed Location Melbourne, Australia Education Self-taught Work DevOps Tech Lead Joined Jan 21, 2022 • Aug 30 '23 Dropdown menu Copy link Hide Can you do this trailer action on an amend? Is it just containing that other email in the required format within the commit body message that does this or is it some kind of annotation? Collapse Expand Vesa Laakso Vesa Laakso Vesa Laakso Follow Co-founder / CTO @VenuuFinland. Open source maintainer https://github.com/webpack-contrib/webpack-bundle-analyzer Location Finland Work CTO at Venuu Joined Mar 23, 2018 • Sep 4 '23 Dropdown menu Copy link Hide Yeah I think you can do a git commit --amend --trailer 'Co-authored-by: name <person@example.com>' Enter fullscreen mode Exit fullscreen mode to get what you want. And couple that with --reuse-message=HEAD to only add the trailer to the most recent commit and not even trigger an editor to open up: git commit --amend --trailer 'Co-authored-by: name <person@example.com>' --reuse-message=HEAD Enter fullscreen mode Exit fullscreen mode Code of Conduct • Report abuse
This is neat! I am myself using the fancy
--trailerflag thatgit commitalso provides to do the same:I have even saved this to a git alias when I'm pair-programming more often so that I get the trailer appended automatically. For example:
Now
git commit-janeallows me to commit with Jane in Co-authored-by :)Ah this is so cool! I'm totally saving this in my gist files. thanks for sharing this!
nice. Appreicating is fulfilling
Woa! This would be a great way of showing them that their time and effort is valued.
Thanks for sharing Cassidy!
Github did this automatically when you commit a suggestion directly. Never know how to do this in command line. Really informative post ⭐️
Nice! 👏
I wrote a similar one some time ago, but to use it alongside
git mob, which is a cool tool for pairing!dev.to/albarin/how-to-easily-add-c...
ah I feel so bad that I didn't know about this until now and so happy that now I know this. Thanks for sharing this Cassidy! <3
This is really great, thanks for sharing how to do this! That Grady guy also seems really cool.
And sooooo smart
There is also more commit msg keywords convention.. for example :
Cf. Src old wiki, and git trailer SO post
Can you do this trailer action on an amend? Is it just containing that other email in the required format within the commit body message that does this or is it some kind of annotation?
Yeah I think you can do a
to get what you want.
And couple that with
--reuse-message=HEADto only add the trailer to the most recent commit and not even trigger an editor to open up: