Skip to content

Repository files navigation

pair

Pair commits with ticket ids and co-authors made simple.

pair-demo

Contents

Why?

I hate seacrhing for the ticket id I'm working on at commit time, so I can include it in the commit message.

Now I don't need to worry about that, I can set the values with pair and have them automatically added to my commits each time.

Install

Download from GitHub

Find the latest version for your system on the GitHub releases page.

Build it locally

If you have go installed, you can clone this repo and run:

make install

This will build the binary and then copy it to /usr/local/bin/pair so it will be available on your path. Nothing more to it.

Commands

Run pair --help for a full, up to date list of available commands.

on

Set the ticket id you are working on.

Tip

Set ticketPrefix in your config file if your tickets always have the same prefix, and you can just type the part after the prefix.

You can pass the ticket directly to the command, or just run pair on for an interactive prompt to enter the ticket id.

pair-on-demo

with

Select co-authors from the list defined in your config file.

pair-with-demo

commit

Commit your staged changes using the values you have already set. If you have not set a ticket id or selected co-authors you will be prompted to set them before running the commit.

Tip

Want to sign your commits? Set -s in the commitArgs field in your config file.

pair-commit-demo)

done

When you're all done with the ticket or work you were doing, you can run pair done to clear the session data temp files.

pair-done-demo

new

Start a new pairing session overwriting your current values.

cur

Show the current pairng session values.

add

Add a co-author to your config file.

Prompts for the co-author's first name, last name and email, then writes them to the coAuthors map in your config file. Set suggestedCoAuthorEmail in your config to have the email prompt pre-filled with a suggestion you can accept or edit (see Suggesting co-author emails).

Configuration

By default pair checks for a config file called pair.json in your $XDG_CONFIG_DIR, or $HOME/.config in a directory e.g: $HOME/.config/pair.json.

Schema

You can see an example of the config file format in the pair.json in the schema directory.

Tip

Make sure you add the $schema keyword to the top of your config file to for in editor validation and descriptions of what fields are used for.

Suggesting co-author emails

The optional suggestedCoAuthorEmail field is a go template string used by the add command to pre-fill the email prompt with a suggestion built from the name you enter (which you can still accept or edit).

The following fields are available:

  • FirstName
  • FirstInitial
  • LastName
  • LastInitial

For example, with "suggestedCoAuthorEmail": "{{.FirstInitial}}{{.LastName}}@example.com", entering the name Jane Doe suggests jdoe@example.com. The rendered value is always lowercased. Leave the field out (or empty) to start the email prompt blank.

About

pair commiting made easier

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages