diff --git a/Commands.md b/Commands.md index 26876b460..dfcbd7251 100644 --- a/Commands.md +++ b/Commands.md @@ -9,6 +9,7 @@ - [`git chore`](#git-featurerefactorbugchore) - [`git clear`](#git-clear) - [`git clear-soft`](#git-clear-soft) + - [`git coauthor`](#git-coauthor) - [`git commits-since`](#git-commits-since) - [`git contrib`](#git-contrib) - [`git count`](#git-count) @@ -347,6 +348,30 @@ Straight from the shell! git (master)> quit ``` +## git coauthor + +Add a co-author to the last commit + +```bash +$ git coauthor user user@email.com + +[master b62ceae] Add documentation files + Date: Sat Aug 17 17:33:53 2019 -0500 + 2 files changed, 145 insertions(+), 0 deletions(-) + create mode 100644 README.md + create mode 100644 CONTRIBUTING.md + + $ git log -1 + +commit b62ceae2685e6ece071f3c3754e9b77fd0a35c88 (HEAD -> master) +Author: user person <userperson@email.com> +Date: Sat Aug 17 17:33:53 2019 -0500 + + Add documentation files + + Co-authored-by: user <user@email.com> +``` + ## git commits-since List commits since `date` (defaults to "last week"): diff --git a/bin/git-coauthor b/bin/git-coauthor new file mode 100755 index 000000000..522f2db80 --- /dev/null +++ b/bin/git-coauthor @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -e -o pipefail + +coauthor=$1 +email=$2 + +test -z "$coauthor" && echo "co-author required." 1>&2 && exit 1 +test -z "$email" && echo "co-author email required." 1>&2 && exit 1 + +old_message="$(git log --format=%B -n1)" +if [[ $old_message == *"Co-authored-by:"* ]]; then + git commit --amend -m "$old_message +Co-authored-by: $coauthor <$email>" +else + git commit --amend -m "$old_message" -m "Co-authored-by: $coauthor <$email>" +fi diff --git a/etc/git-extras-completion.zsh b/etc/git-extras-completion.zsh index 713121050..0552eca42 100644 --- a/etc/git-extras-completion.zsh +++ b/etc/git-extras-completion.zsh @@ -196,6 +196,11 @@ _git-chore() { '(--remote -r)'{--remote,-r}'[setup remote tracking branch]' } +_git-coauthor() { + _arguments \ + ':co-author[co-author to add]' \ + ':co-author-email[email address of co-author to add]' +} _git-contrib() { _arguments \ @@ -441,6 +446,7 @@ zstyle ':completion:*:*:git:*' user-commands $existing_user_commands \ chore:'create chore branch' \ clear-soft:'soft clean up a repository' \ clear:'rigorously clean up a repository' \ + coauthor: 'add a co-author to the last commit' \ commits-since:'show commit logs since some date' \ contrib:'show user contributions' \ count:'show commit count' \ diff --git a/man/git-coauthor.1 b/man/git-coauthor.1 new file mode 100644 index 000000000..9e8acf424 --- /dev/null +++ b/man/git-coauthor.1 @@ -0,0 +1,42 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-COAUTHOR" "1" "August 2019" "" "Git Extras" +. +.SH "NAME" +\fBgit\-coauthor\fR \- Add a co\-author to the last commit +. +.SH "SYNOPSIS" +\fBgit\-coauthor\fR <co\-author> <co\-author\-email> +. +.SH "DESCRIPTION" +Add a co\-author to the last commit +. +.SH "OPTIONS" +<co\-author> +. +.P +The username of the co\-author you want to add\. +. +.P +<co\-author\-email> +. +.P +The email address of the author you want to add\. +. +.SH "EXAMPLES" +. +.nf + +$ git coauthor user user@email\.com +. +.fi +. +.SH "AUTHOR" +Written by Jacob Herrington \fIjacobherringtondeveloper@gmail\.com\fR +. +.SH "REPORTING BUGS" +<\fIhttps://github\.com/tj/git\-extras/issues\fR> +. +.SH "SEE ALSO" +<\fIhttps://github\.com/tj/git\-extras\fR> diff --git a/man/git-coauthor.html b/man/git-coauthor.html new file mode 100644 index 000000000..f7a7ac71e --- /dev/null +++ b/man/git-coauthor.html @@ -0,0 +1,121 @@ +<!DOCTYPE html> +<html> +<head> + <meta http-equiv='content-type' value='text/html;charset=utf8'> + <meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'> + <title>git-coauthor(1) - Add a co-author to the last commit</title> + <style type='text/css' media='all'> + /* style: man */ + body#manpage {margin:0} + .mp {max-width:100ex;padding:0 9ex 1ex 4ex} + .mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0} + .mp h2 {margin:10px 0 0 0} + .mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex} + .mp h3 {margin:0 0 0 4ex} + .mp dt {margin:0;clear:left} + .mp dt.flush {float:left;width:8ex} + .mp dd {margin:0 0 0 9ex} + .mp h1,.mp h2,.mp h3,.mp h4 {clear:left} + .mp pre {margin-bottom:20px} + .mp pre+h2,.mp pre+h3 {margin-top:22px} + .mp h2+pre,.mp h3+pre {margin-top:5px} + .mp img {display:block;margin:auto} + .mp h1.man-title {display:none} + .mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143} + .mp h2 {font-size:16px;line-height:1.25} + .mp h1 {font-size:20px;line-height:2} + .mp {text-align:justify;background:#fff} + .mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211} + .mp h1,.mp h2,.mp h3,.mp h4 {color:#030201} + .mp u {text-decoration:underline} + .mp code,.mp strong,.mp b {font-weight:bold;color:#131211} + .mp em,.mp var {font-style:italic;color:#232221;text-decoration:none} + .mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff} + .mp b.man-ref {font-weight:normal;color:#434241} + .mp pre {padding:0 4ex} + .mp pre code {font-weight:normal;color:#434241} + .mp h2+pre,h3+pre {padding-left:0} + ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px} + ol.man-decor {width:100%} + ol.man-decor li.tl {text-align:left} + ol.man-decor li.tc {text-align:center;letter-spacing:4px} + ol.man-decor li.tr {text-align:right;float:right} + </style> +</head> +<!-- + The following styles are deprecated and will be removed at some point: + div#man, div#man ol.man, div#man ol.head, div#man ol.man. + + The .man-page, .man-decor, .man-head, .man-foot, .man-title, and + .man-navigation should be used instead. +--> +<body id='manpage'> + <div class='mp' id='man'> + + <div class='man-navigation' style='display:none'> + <a href="#NAME">NAME</a> + <a href="#SYNOPSIS">SYNOPSIS</a> + <a href="#DESCRIPTION">DESCRIPTION</a> + <a href="#OPTIONS">OPTIONS</a> + <a href="#EXAMPLES">EXAMPLES</a> + <a href="#AUTHOR">AUTHOR</a> + <a href="#REPORTING-BUGS">REPORTING BUGS</a> + <a href="#SEE-ALSO">SEE ALSO</a> + </div> + + <ol class='man-decor man-head man head'> + <li class='tl'>git-coauthor(1)</li> + <li class='tc'>Git Extras</li> + <li class='tr'>git-coauthor(1)</li> + </ol> + + <h2 id="NAME">NAME</h2> +<p class="man-name"> + <code>git-coauthor</code> - <span class="man-whatis">Add a co-author to the last commit</span> +</p> + +<h2 id="SYNOPSIS">SYNOPSIS</h2> + +<p><code>git-coauthor</code> <co-author> <co-author-email></p> + +<h2 id="DESCRIPTION">DESCRIPTION</h2> + +<p> Add a co-author to the last commit</p> + +<h2 id="OPTIONS">OPTIONS</h2> + +<p> <co-author></p> + +<p> The username of the co-author you want to add.</p> + +<p> <co-author-email></p> + +<p> The email address of the author you want to add.</p> + +<h2 id="EXAMPLES">EXAMPLES</h2> + +<pre><code>$ git coauthor user user@email.com +</code></pre> + +<h2 id="AUTHOR">AUTHOR</h2> + +<p>Written by Jacob Herrington <a href="mailto:jacobherringtondeveloper@gmail.com" data-bare-link="true">jacobherringtondeveloper@gmail.com</a></p> + +<h2 id="REPORTING-BUGS">REPORTING BUGS</h2> + +<p><<a href="https://github.com/tj/git-extras/issues" data-bare-link="true">https://github.com/tj/git-extras/issues</a>></p> + +<h2 id="SEE-ALSO">SEE ALSO</h2> + +<p><<a href="https://github.com/tj/git-extras" data-bare-link="true">https://github.com/tj/git-extras</a>></p> + + + <ol class='man-decor man-foot man foot'> + <li class='tl'></li> + <li class='tc'>August 2019</li> + <li class='tr'>git-coauthor(1)</li> + </ol> + + </div> +</body> +</html> diff --git a/man/git-coauthor.md b/man/git-coauthor.md new file mode 100644 index 000000000..15d8181ae --- /dev/null +++ b/man/git-coauthor.md @@ -0,0 +1,36 @@ +git-coauthor(1) -- Add a co-author to the last commit +================================ + +## SYNOPSIS + +`git-coauthor` <co-author> <co-author-email> + +## DESCRIPTION + + Add a co-author to the last commit + +## OPTIONS + + <co-author> + + The username of the co-author you want to add. + + <co-author-email> + + The email address of the author you want to add. + +## EXAMPLES + + $ git coauthor user user@email.com + +## AUTHOR + +Written by Jacob Herrington <jacobherringtondeveloper@gmail.com> + +## REPORTING BUGS + +<<https://github.com/tj/git-extras/issues>> + +## SEE ALSO + +<<https://github.com/tj/git-extras>> diff --git a/man/git-extras.md b/man/git-extras.md index ab09ec63b..788653dfc 100644 --- a/man/git-extras.md +++ b/man/git-extras.md @@ -31,6 +31,7 @@ git-extras(1) -- Awesome GIT utilities - **git-chore(1)** Create chore branch - **git-clear-soft(1)** Soft clean up a repository - **git-clear(1)** Rigorously clean up a repository + - **git-coauthor(1)** Add a co-author to the last commit - **git-commits-since(1)** Show commit logs since some date - **git-contrib(1)** Show user's contributions - **git-count(1)** Show commit count diff --git a/man/index.txt b/man/index.txt index e90c14c02..f4ab5c021 100644 --- a/man/index.txt +++ b/man/index.txt @@ -9,6 +9,7 @@ git-changelog(1) git-changelog git-chore(1) git-chore git-clear-soft(1) git-clear-soft git-clear(1) git-clear +git-coauthor(1) git-coauthor git-commits-since(1) git-commits-since git-contrib(1) git-contrib git-count(1) git-count