Compare commits
No commits in common. "a3eb26d6ade18aa791620245e5cb6b7f43f5a7a3" and "017279d7278b38c8a6335ee9df242b258018d607" have entirely different histories.
a3eb26d6ad
...
017279d727
4 changed files with 0 additions and 78 deletions
1
Gemfile
1
Gemfile
|
@ -16,7 +16,6 @@ gem "no-style-please", git: "https://github.com/atomaka/no-style-please", branch
|
||||||
# gem "github-pages", group: :jekyll_plugins
|
# gem "github-pages", group: :jekyll_plugins
|
||||||
# If you have any plugins, put them here!
|
# If you have any plugins, put them here!
|
||||||
group :jekyll_plugins do
|
group :jekyll_plugins do
|
||||||
gem "jekyll-compose"
|
|
||||||
gem "jekyll-feed", "~> 0.12"
|
gem "jekyll-feed", "~> 0.12"
|
||||||
gem "jekyll-gist"
|
gem "jekyll-gist"
|
||||||
gem "jekyll-tidy"
|
gem "jekyll-tidy"
|
||||||
|
|
|
@ -58,8 +58,6 @@ GEM
|
||||||
safe_yaml (~> 1.0)
|
safe_yaml (~> 1.0)
|
||||||
terminal-table (>= 1.8, < 4.0)
|
terminal-table (>= 1.8, < 4.0)
|
||||||
webrick (~> 1.7)
|
webrick (~> 1.7)
|
||||||
jekyll-compose (0.12.0)
|
|
||||||
jekyll (>= 3.7, < 5.0)
|
|
||||||
jekyll-feed (0.17.0)
|
jekyll-feed (0.17.0)
|
||||||
jekyll (>= 3.7, < 5.0)
|
jekyll (>= 3.7, < 5.0)
|
||||||
jekyll-gist (1.5.0)
|
jekyll-gist (1.5.0)
|
||||||
|
@ -137,7 +135,6 @@ PLATFORMS
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
http_parser.rb (~> 0.6.0)
|
http_parser.rb (~> 0.6.0)
|
||||||
jekyll (~> 4.3.2)
|
jekyll (~> 4.3.2)
|
||||||
jekyll-compose
|
|
||||||
jekyll-feed (~> 0.12)
|
jekyll-feed (~> 0.12)
|
||||||
jekyll-gist
|
jekyll-gist
|
||||||
jekyll-import!
|
jekyll-import!
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
---
|
|
||||||
layout: post
|
|
||||||
title: Give credit where credit's due
|
|
||||||
date: 2023-04-15 09:17 -0400
|
|
||||||
---
|
|
||||||
|
|
||||||
I love pair programming. It is a great way to improve solutions, share context,
|
|
||||||
and continuously review code. But the passenger in a pairing session often ends
|
|
||||||
up being the unsung hero, not showing up in the commit history for their
|
|
||||||
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
|
|
||||||
properly attribute them in Github's commit log.
|
|
||||||
|
|
||||||
I have used this to share credit for several years, but it is a bit painful.
|
|
||||||
Making sure to type your partner's name and email is a hassle. Any typo will
|
|
||||||
not credit appropriately and become permanantly engraved in the history of your
|
|
||||||
repository when you merge it to master!
|
|
||||||
|
|
||||||
So avoid the typos!
|
|
||||||
|
|
||||||
First, I created a simple git alias that will allow me to easily modify a commit
|
|
||||||
to add a trailer. In your global `.gitconfig` file, add
|
|
||||||
|
|
||||||
```
|
|
||||||
[alias]
|
|
||||||
add-trailer = commit --no-edit --amend --trailer
|
|
||||||
```
|
|
||||||
|
|
||||||
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>"`
|
|
||||||
|
|
||||||
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
|
|
||||||
still painful to do manually. [Fzf][3] can help us here though. We can pass our
|
|
||||||
log information into fzf and then pass our selection on to our newly created git
|
|
||||||
alias:
|
|
||||||
|
|
||||||
```
|
|
||||||
git log --pretty="%an <%ae>" \
|
|
||||||
| sort -u \
|
|
||||||
| fzf \
|
|
||||||
| xargs -I "{}" git add-trailer "Co-authored-by: {}"
|
|
||||||
```
|
|
||||||
|
|
||||||
Breaking this down:
|
|
||||||
* `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
|
|
||||||
|
|
||||||
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 <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/
|
|
||||||
[3]: https://github.com/junegunn/fzf
|
|
Binary file not shown.
Before Width: | Height: | Size: 351 KiB |
Loading…
Add table
Reference in a new issue