And new post: git attribution #4
1 changed files with 14 additions and 13 deletions
|
@ -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
|
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,
|
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
|
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.
|
properly attribute them in Github's commit log.
|
||||||
|
|
||||||
I have used this to share credit for several years, but it is a bit painful.
|
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:
|
This can be used as part of a two step process:
|
||||||
|
|
||||||
1. Make your commit as you normally would
|
1. Make your commit as you normally would
|
||||||
2. Use the alias to add a trailer
|
1. Use the alias to add a trailer
|
||||||
* `git add-trailer "Co-authored-by: Partner <a@example.com>"`
|
|
||||||
|
- `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
|
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
|
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:
|
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
|
for attribution
|
||||||
* `sort -u`
|
- `sort -u`
|
||||||
* Make the list sorted and unique
|
- Make the list sorted and unique
|
||||||
* `fzf`
|
- `fzf`
|
||||||
* Prompt us to make a selection from the list
|
- Prompt us to make a selection from the list
|
||||||
* `xargs -I "{}" git add-trailer "Co-authored-by: {}"`
|
- `xargs -I "{}" git add-trailer "Co-authored-by: {}"`
|
||||||
* Take the result from our prompt and pass it into our new git alias
|
- Take the result from our prompt and pass it into our new git alias
|
||||||
|
|
||||||
And when everything is in place, attribution is a breeze!
|
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:
|
And in the spirit of attribution, thanks to last week's pairing partner:
|
||||||
|
|
||||||
Encouraged-by: nichol alexander <nichol.alexander@gmail.com>
|
Encouraged-by: nichol alexander \<nichol.alexander@gmail.com>
|
||||||
|
|
||||||
|
|
||||||
[1]: https://git-scm.com/docs/git-interpret-trailers
|
[1]: https://git-scm.com/docs/git-interpret-trailers
|
||||||
[2]: https://github.blog/2018-01-29-commit-together-with-co-authors/
|
[2]: https://github.blog/2018-01-29-commit-together-with-co-authors/
|
||||||
|
|
Loading…
Reference in a new issue