Coder Social home page Coder Social logo

co-authored-commit's Introduction

co-authored-commit

GitHub provides a mechanism to create commits with multiple authors, which are visible on GitHub interface. However, git does not have a built-in command to execute this action easily. This project comes up with a Git Alias in order to create Co-authored commits using the command line.

Install

Add alias located at the config file to the bottom of one of the following git configuration file:

  • For global scope : ~/.gitconfig or ~/.config/git/config
  • For system scope : /etc/gitconfig
  • For project scope : .git/config
[alias]
    co-commit = "!co_authored_commit(){ usage='usage: git commit -m \"Commit message\" --co \"co_author_name\"\n'; while [ \"${#}\" -gt 0 ]; do case \"${1}\" in -m) shift; message="${1}"; shift;; --co) shift; co_author=\"Co-authored-by: \"${1}\"\n\"; co_authors=\"${co_authors}${co_author}\"; shift;; *) shift;; esac; done; if [ -z \"${co_authors}\" ]; then echo ${usage}; exit 1; fi; if [ -z \"${message}\" ]; then echo ${usage}; exit 1; fi; co_authored_message=\"${message}\n\n\n${co_authors}\"; git commit -m \"${co_authored_message}\"; }; co_authored_commit"

Usage

After the installation step, you are able to perform the following command:

$ git co-commit -m "Commit message" --co "co-author <co-author-email>"

The -m flag is the commit message flag, the same as the git commit command.

The --co flag is passed to inform both co-author name and email. If one chooses to keep their email private, use <no-reply> instead.

If you pass --co flag with co author email both will be authors, otherwise only the person who commited will be seen by github.

commit with email

commit without email

You can see the first commit here and the second here.

It is possible to pass multiple --co flags.

Example

$ git co-commit -m "this is my commit message" --co "username <[email protected]>"

Limitations

For now, it is mandatory to pass the the git commit message flag.

License

This repository is licensed under GPL-3.0

co-authored-commit's People

Contributors

filipefilardi avatar foo0x29a 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.