schustafa / gh-pairing-with

πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» gh CLI extension for generating a co-authored-by: string

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gh-pairing-with

A simple gh extension for sharing credit.

Background

Did you know that GitHub can show multiple authors in commit statistics? For example, see the early history of this repository:

Early commits to this repository, showing contributions from both @schustafa and @stephanieg0

For GitHub to know what users besides the author to credit, you must include a special Co-authored-by: string in your commit message. Unfortunately, the format is finicky (make sure your hyphens are in the right place!) and you need to correctly include the name and email address associated with your coauthor's GitHub account.

I lost count of how many times I fat-fingered this string, committed, pushed, and then realized that I'd gotten something wrong. This extension exists to make getting it right slightly easier.

Installation

Install the CLI

brew install gh

Install the extension

gh extension install schustafa/gh-pairing-with

Commands

Run gh pairing-with <github-login>....

For example, if you're pairing with Miss Monalisa Octocat, you'll run:

> gh pairing-with mona
Co-authored-by: Monalisa Octocat <92997159+mona@users.noreply.github.com>

Paste the string returned into your commit message to share credit with your pairing partner!

If you're on a Mac, pipe the output to pbcopy to get the Co-authored-by string automatically added to your pasteboard, ready to paste!

gh pairing-with mona | pbcopy

gh-pairing-with supports fetching user information for multiple users at once too! So if you're, uh, "pairing" with a handful of people, you can pass multiple usernames at once. For example:

> gh pairing-with mona schustafa
Co-authored-by: Monalisa Octocat <92997159+mona@users.noreply.github.com>
Co-authored-by: AJ Schuster <126731+schustafa@users.noreply.github.com>

Troubleshooting

Scopes

If you receive a message like the following:

GraphQL: Your token has not been granted the required scopes to execute this query. The 'email' field requires one of the following scopes: ['user:email', 'read:user'], but your token has only been granted the: [...]

You can add those scopes to your gh token by running the following:

gh auth refresh --scopes user:email,read:user

Resources

About

πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» gh CLI extension for generating a co-authored-by: string


Languages

Language:Go 100.0%