And new post: git attribution #4

Merged
atomaka merged 3 commits from credit-post into master 2023-04-16 12:27:20 -04:00
Showing only changes of commit 3af5d35222 - Show all commits

View file

@ -12,7 +12,7 @@ invaluable contributions because they were not typing on the keyboard.
Commit logs are obviously not the authority on an individual's contributions to
a codebase, but I still like to give credit where credit is due. Fortunately,
using git's [trailers][1], Github allows you to [commit together][2]. Including
a `Co-authored-by:` citation with your pairing partner's name and email will
a `Co-authored-by:` citation with your pairing partner's name and email will
properly attribute them in Github's commit log.
I have used this to share credit for several years, but it is a bit painful.
@ -33,8 +33,9 @@ to add a trailer. In your global `.gitconfig` file, add
This can be used as part of a two step process:
1. Make your commit as you normally would
2. Use the alias to add a trailer
* `git add-trailer "Co-authored-by: Partner <a@example.com>"`
1. Use the alias to add a trailer
- `git add-trailer "Co-authored-by: Partner <a@example.com>"`
We can still have typos though. But if our pairing partner has worked on this
repository in the past, we can find their information in the git log. This is
@ -50,15 +51,16 @@ git log --pretty="%an <%ae>" \
```
Breaking this down:
* `git log --pretty="%an <%ae>"`
* List the author of every commit in our repositry and format it appropriately
- `git log --pretty="%an <%ae>"`
- List the author of every commit in our repositry and format it appropriately
for attribution
* `sort -u`
* Make the list sorted and unique
* `fzf`
* Prompt us to make a selection from the list
* `xargs -I "{}" git add-trailer "Co-authored-by: {}"`
* Take the result from our prompt and pass it into our new git alias
- `sort -u`
- Make the list sorted and unique
- `fzf`
- Prompt us to make a selection from the list
- `xargs -I "{}" git add-trailer "Co-authored-by: {}"`
- Take the result from our prompt and pass it into our new git alias
And when everything is in place, attribution is a breeze!
@ -66,8 +68,7 @@ And when everything is in place, attribution is a breeze!
And in the spirit of attribution, thanks to last week's pairing partner:
Encouraged-by: nichol alexander &lt;nichol.alexander@gmail.com&gt;
Encouraged-by: nichol alexander \<nichol.alexander@gmail.com>
[1]: https://git-scm.com/docs/git-interpret-trailers
[2]: https://github.blog/2018-01-29-commit-together-with-co-authors/