diff --git a/bin/git-authors b/bin/git-authors new file mode 100755 index 0000000..194a64b --- /dev/null +++ b/bin/git-authors @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +LIST=false +FILE="" + +if test "$1" = "-l" || test "$1" = "--list"; then + LIST=true +else + FILE=$1 + if test "$FILE" = ""; then + FILE=`ls | egrep 'authors|contributors' -i|head -n1` + if test "$FILE" = ""; then + FILE='AUTHORS' + fi + fi +fi + +# +# list authors sorted by number of commits (descending). +# + +authors() { + git shortlog -sne | awk '{$1=""; sub(" ", ""); print}' +} + +# +# authors. +# + +if $LIST; then + echo "$(authors)" +else + authors >> $FILE + test -n "$EDITOR" && $EDITOR $FILE +fi diff --git a/etc/bash_completion.sh b/etc/bash_completion.sh index 3c6dffc..8280155 100644 --- a/etc/bash_completion.sh +++ b/etc/bash_completion.sh @@ -10,6 +10,9 @@ _git_changelog(){ _git_chore(){ __git_extras_workflow "chore" + +_git_authors(){ + __gitcomp "-l --list" } _git_contrib(){ diff --git a/man/git-authors.1 b/man/git-authors.1 new file mode 100644 index 0000000..9142fce --- /dev/null +++ b/man/git-authors.1 @@ -0,0 +1,61 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-AUTHORS" "1" "February 2015" "" "Git Extras" +. +.SH "NAME" +\fBgit\-authors\fR \- Generate authors report +. +.SH "SYNOPSIS" +\fBgit\-authors\fR [\-l, \-\-list] +. +.SH "DESCRIPTION" +Populates the file matching \fIauthors|contributors \-i\fR with the authors of commits, according to the number of commits per author\. Opens the file in \fB$EDITOR\fR when set\. +. +.P +See the "MAPPING AUTHORS" section of \fBgit\-shortlog\fR(1) to coalesce together commits by the same person\. +. +.SH "OPTIONS" +\-l, \-\-list +. +.P +Show authors\. +. +.SH "EXAMPLES" +. +.TP +Updating AUTHORS file: +. +.IP +$ git authors +. +.TP +Listing authors: +. +.IP +$ git authors \-\-list +. +.IP "" 4 +. +.nf + +TJ Holowaychuk +Tj Holowaychuk +hemanth\.hm +Jonhnny Weslley +nickl\- +Leila Muhtasib +. +.fi +. +.IP "" 0 + +. +.SH "AUTHOR" +Written by Titus Wormer <\fItituswormer@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-authors.html b/man/git-authors.html new file mode 100644 index 0000000..cb7fee9 --- /dev/null +++ b/man/git-authors.html @@ -0,0 +1,135 @@ + + + + + + git-authors(1) - Generate authors report + + + + +
+ + + +
    +
  1. git-authors(1)
  2. +
  3. Git Extras
  4. +
  5. git-authors(1)
  6. +
+ +

NAME

+

+ git-authors - Generate authors report +

+ +

SYNOPSIS

+ +

git-authors [-l, --list]

+ +

DESCRIPTION

+ +

Populates the file matching authors|contributors -i with the authors of commits, according to the number of commits per author. + Opens the file in $EDITOR when set.

+ +

See the "MAPPING AUTHORS" section of git-shortlog(1) to coalesce together commits by the same person.

+ +

OPTIONS

+ +

-l, --list

+ +

Show authors.

+ +

EXAMPLES

+ +
+
Updating AUTHORS file:

+ +

$ git authors

+
Listing authors:

+ +

$ git authors --list

+ +
TJ Holowaychuk <tj@vision-media.ca>
+Tj Holowaychuk <tj@vision-media.ca>
+hemanth.hm <hemanth.hm@gmail.com>
+Jonhnny Weslley <jw@jonhnnyweslley.net>
+nickl- <github@jigsoft.co.za>
+Leila Muhtasib <muhtasib@gmail.com>
+
+
+ + +

AUTHOR

+ +

Written by Titus Wormer <tituswormer@gmail.com>

+ +

REPORTING BUGS

+ +

<https://github.com/tj/git-extras/issues>

+ +

SEE ALSO

+ +

<https://github.com/tj/git-extras>

+ + +
    +
  1. +
  2. February 2015
  3. +
  4. git-authors(1)
  5. +
+ +
+ + diff --git a/man/git-authors.md b/man/git-authors.md new file mode 100644 index 0000000..8ff4943 --- /dev/null +++ b/man/git-authors.md @@ -0,0 +1,50 @@ +git-authors(1) -- Generate authors report +================================================= + +## SYNOPSIS + +`git-authors` [-l, --list] + +## DESCRIPTION + + Populates the file matching _authors|contributors -i_ with the authors of commits, according to the number of commits per author. + Opens the file in **$EDITOR** when set. + + See the "MAPPING AUTHORS" section of **git-shortlog**(1) to coalesce together commits by the same person. + +## OPTIONS + + -l, --list + + Show authors. + +## EXAMPLES + + * Updating AUTHORS file: + + $ git authors + + * Listing authors: + + $ git authors --list + + ``` + TJ Holowaychuk + Tj Holowaychuk + hemanth.hm + Jonhnny Weslley + nickl- + Leila Muhtasib + ``` + +## AUTHOR + +Written by Titus Wormer <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<>