New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gitpair

Package Overview
Dependencies
Maintainers
2
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitpair

Allow you to commit with more than one person, e.g. Pair programming or Mob programming.

  • 1.0.0-beta.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
17
decreased by-70.69%
Maintainers
2
Weekly downloads
 
Created
Source


gitpair

When pairing or doing mob programming on github projects, git does not allow us to commit with all the names of people who contributed. gitpair allows you to setup your team members and commit as normal. It then changes your commit based on the list of people referenced in the commit message.

Each author will randomly be credited with commiter or authorship, so that we can each be credited in our github contributions view !

Before gitpair :sob:

before

After gitpair :heart_eyes:

after

gitpair does not require you to change the way you commit. Simplify use the git commit command or your favorite tool!

Example:

The following two commits

$ commit -am "JBH|BDO|JON Added README file"
$ commit -am "@jordan @benoit @jonathan Added README file"

are equivalent and will result in the following commit:

commit 5aac6c15b7ea2b8ed6b8daaba01539931b9d9309
Author:     Jordan Bartholomew-Harrison, Benoit d'Oncieu and Jon McClennon <bdoncieu@gmail.com>
AuthorDate: Thu Oct 27 22:09:34 2016 +0200
Commit:     Jon McClennon <Jon.McClennon@gmail.com>
CommitDate: Thu Oct 27 22:09:34 2016 +0200

    BDO|JM: Added README file

The author's name contains the list of all author names while the author and committer emails will be randomly choosen amongst the list of committers. The commit message is normalised as a pipe separated list of initials followed by a dash.

Installation

Pre-requisites

A recent version of node and npm.

Install

$ npm install --save gitpair
With husky

Update your package.json to run the hook script:

{
  ...
  "scripts": {
    "postcommit": "$(npm bin)/gitpair hook"
  }
}
Manually adding the hook
$(npm bin)/gitpair install

The installation adds a post-commit hook at the root of your project in the .git/hooks directory.

Configure

Create a .gitpair file in your project or home folder:

{
  "team": [
    { "name": "Benoit d'Oncieu", "aliases": ["bdo", "benoit"], "email": "bdoncieu@gmail.com" },
    {
      "name": "Jon McClennon",
      "aliases": ["jm", "jon", "jonathan", "jonathanmcclennon"],
      "email": "Jon.McClennon@gmail.com"
    },
    {
      "name": "Jordan Bartholomew-Harrison",
      "aliases": ["jbh", "jordan", "jordanbharrison"],
      "email": "jordan.bh@outlook.com"
    }
  ]
}

In a project, you can get this file started by running:

$(npm bin)/gitpair init

Commit message patterns

You can use one of two styles of commit messages. The user names used must correspond to one of the aliases you listed in your .gitpair file (see above).

Github styledInitials
@bdo @jon Added package.jsonBDO|JON: Added package.json

Notes:

  • The normalised format message will use the Initials pattern and the first alias for each author.
  • When using the Initials flavor, the semicolon is optional.
  • When using the github styled initials, you can also specify users not in your team by tagging their github username. The git hook will ask if you want to add their info to your team.

Should I commit my .gitpair file into my repo?

There are a few questions you need to ask yourself to answer this:

  • Is my repository private?
  • Should I be exposing email addresses in my repository (a more important question for public repositories)?
  • Will everyone working on this repository be pairing with the same people?

If you answered no to any of these questions, then you likely want to have .gitpair in your local .gitignore.

Uninstall

Remove git hook

$(npm bin)/gitpair install -u

Removing the package

$ npm uninstall gitpair

This automatically removes the post-commit hook if it exists.

Keywords

FAQs

Package last updated on 23 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc