Code Monkey home page Code Monkey logo

git-pair's Introduction

git-pair ๐Ÿ

git-pair is a bash script that enables you to simply add your co-authors to your commits.

Acknowledge everyone that contributes to the commit.

See example with many authors.

Features

  • Amend previous commit message by appending Co-authored-by: ..
  • Autocompletion git-pair <TAB><TAB>
  • Multiple Co-authors
  • Idempotent
    • Co-authors will be unique and sorted alphabetically

Installation

  1. Clone the repo

    git clone https://github.com/ninth-dev/git-pair.git
  2. Create an file $HOME/.git-pair and add your team mates

    e.g.

    # Follow the pattern: alias name <email>
    (
    echo "john-smith John Smith <[email protected]>"
    echo "jane-doe Jane Doe <[email protected]>"
    echo "alice Alice <[email protected]>"
    echo "bob Bob <[email protected]>"
    ) > $HOME/.git-pair

    NB: You can just open the file $HOME/.git-pair and use your favourite editor :)

  3. Source the git-pair script to your shell startup file (e.g. .zshrc, .bashrc)

    source <PATH_TO_GIT_PAIR>/git-pair.sh
  4. Restart your shell or source your startup file.

Getting Started

After committing and you want to add your pair (co-author) in.

$ git commit --message "nit: some random bugfix"
$ git-pair john-smith
๐Ÿ'd with John Smith <[email protected]>

This will amend the previous commit message :

$ git log -1
.
.
Co-authored-by: John Smith <[email protected]>

Want to add another pair?

$ git-pair jane-doe
๐Ÿ'd with Jane Doe <[email protected]>
$ git log -1
.
.
Co-authored-by: Jane Doe <[email protected]>
Co-authored-by: John Smith <[email protected]>

Mob programming?

You could also simply just create an alias for your mob-programming sessions.

alias git-mob='git-pair john-smith && git-pair jane-doe && git-pair alice && git-pair bob'
$ git-mob
๐Ÿ'd with John Smith <[email protected]>
๐Ÿ'd with Jane Doe <[email protected]>
๐Ÿ'd with Alice <[email protected]>
๐Ÿ'd with Bob <[email protected]>

$ git log -1
.
.
Co-authored-by: Alice <[email protected]>
Co-authored-by: Bob <[email protected]>
Co-authored-by: Jane Doe <[email protected]>
Co-authored-by: John Smith <[email protected]>

# NB: Co-authors are sorted alphabetically

git-pair's People

Contributors

ninth-dev avatar

Stargazers

Cheng Yang avatar  avatar Laurens Claessen avatar Joe Pramono avatar Jack Low avatar rdauj avatar M.Y. avatar Dave avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.