diff --git a/Commands.md b/Commands.md index d463cae1c..09557839f 100644 --- a/Commands.md +++ b/Commands.md @@ -41,6 +41,7 @@ - [`git scp`](#git-scp) - [`git sed`](#git-sed) - [`git setup`](#git-setup) + - [`git standup`](#git-standup) - [`git squash`](#git-squash) - [`git summary`](#git-summary) - [`git sync`](#git-sync) @@ -793,6 +794,13 @@ Internally this script uses `rsync` and not `scp` as the name suggests. $ git scp staging js/vendor/ +## git standup + +Recall what you did or find what someone else did in a given range of time. +For instance, recall John's commits since last week: +``` +git standup John "last week" +``` ## git touch diff --git a/bin/git-standup b/bin/git-standup new file mode 100755 index 000000000..385d464b9 --- /dev/null +++ b/bin/git-standup @@ -0,0 +1,90 @@ +#!/usr/bin/env bash + +# Code modified from https://github.com/kamranahmedse/git-standup, +# under the MIT LICENSE. +if [[ $# -gt 3 ]] ; then + >&2 printf "Usage: $0 [fullname] [since] [until]\nExample: $0 \"John Doe\" \"last Mon\" yesterday\n" + exit 1 +fi + +git rev-parse --show-toplevel > /dev/null 2>&1 +in_git_repo=$? + +# Use colors, but only if connected to a terminal, and that terminal +# supports them. +if which tput >/dev/null 2>&1; then + ncolors=$(tput colors) +fi +if [[ -t 1 ]] && [[ -n "$ncolors" ]] && [[ "$ncolors" -ge 8 ]] ; then + RED="$(tput setaf 1)" + GREEN="$(tput setaf 2)" + YELLOW="$(tput setaf 3)" + BLUE="$(tput setaf 4)" + BOLD="$(tput bold)" + NORMAL="$(tput sgr0)" + BOLD=$(tput bold) + UNDERLINE=$(tput smul) + NORMAL=$(tput sgr0) +else + RED="" + GREEN="" + YELLOW="" + BLUE="" + BOLD="" + NORMAL="" + BOLD="" + UNDERLINE="" + NORMAL="" +fi + +# Only enable exit-on-error after the non-critical colorization stuff, +# which may fail on systems lacking tput or terminfo +set -e + +AUTHOR=${1:-"$(git config user.name)"} +SINCE=${2:-yesterday} +UNTIL=${3:-today} + + +## In case it is the start of week, we need to +## show the commits since the last weekend +shopt -s nocasematch + +GIT_LOG_COMMAND="git --no-pager log \ + --all + --no-merges + --since \"$SINCE\" + --until \"$UNTIL\" + --author=\"$AUTHOR\" + --abbrev-commit + --oneline + --pretty=format:'%Cred%h%Creset - %s %Cgreen(%cr) %C(bold blue)<%an>%Creset'" + +## For when the command has been run in a non-repo directory +if [[ $in_git_repo != 0 ]]; then + + ## Iterate through all the top level directories inside + ## and look for any git repositories. + for DIR in */ ; do + + cd "$DIR" + + ## Show the detail only if it is a git repository + if [[ -d ".git" ]] ; then + if GITOUT=$(eval ${GIT_LOG_COMMAND}); then + ## Only output if there is some activity + if [[ ! -z "$GITOUT" ]] ; then + echo "${BOLD}${UNDERLINE}${YELLOW}$DIR${NORMAL}" + echo "$GITOUT" + fi + else + echo "Repository under $DIR could not be queried. Missing initial commit?" >&2 + fi + fi + + cd .. + done +else + eval ${GIT_LOG_COMMAND} + echo "" ## To avoid that ugly # icon representing the end of line +fi diff --git a/man/git-standup.1 b/man/git-standup.1 new file mode 100644 index 000000000..9a30648f1 --- /dev/null +++ b/man/git-standup.1 @@ -0,0 +1,94 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-STANDUP" "1" "April 2016" "" "" +. +.SH "NAME" +\fBgit\-standup\fR \- Recall the commit history +. +.SH "SYNOPSIS" +\fBgit\-standup\fR [] [] [] +. +.SH "DESCRIPTION" +Recall what you did on the last working day \.\.or be nosy and find what someone else did\. +. +.SH "OPTIONS" + +. +.P +The author of commits\. Defaults to \fB$(git config user\.name)\fR\. +. +.P + +. +.P +The start of commit history\. Defaults to \fByesterday\fR\. +. +.P + +. +.P +The end of commit history\. Defaults to \fBtoday\fR\. +. +.SH "EXAMPLES" +This shows your commits since yesterday: +. +.IP "" 4 +. +.nf + +$ git standup + +a26d1f9 \- add profile hook (69 minutes ago) +. +.fi +. +.IP "" 0 +. +.P +This shows the author\'s commits since last week: +. +.IP "" 4 +. +.nf + +$ git standup spacewander "last week" + +a26d1f9 \- add profile hook (70 minutes ago) +4e19859 \- fix getTotalSize return value error (6 days ago) +36da84e \- fix rename over bound (7 days ago) +8e4182a \- add watermark\.png (7 days ago) +46fef1d \- use tinyXML to configure (7 days ago) +. +.fi +. +.IP "" 0 +. +.P +If current directory is not a git repo, git\-standup will fetch data from all top\-level git repos under it: +. +.IP "" 4 +. +.nf + +$ cd \.\. +$ git standup spacewander "last week" yesterday + +someProject/ +4e19859 \- fix getTotalSize return value error (6 days ago) +36da84e \- fix rename over bound (7 days ago) +8e4182a \- add watermark\.png (7 days ago) +46fef1d \- use tinyXML to configure (7 days ago) +. +.fi +. +.IP "" 0 +. +.SH "AUTHOR" +Originally from https://github\.com/kamranahmedse/git\-standup +. +.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-standup.html b/man/git-standup.html new file mode 100644 index 000000000..938ac2cad --- /dev/null +++ b/man/git-standup.html @@ -0,0 +1,152 @@ + + + + + + git-standup(1) - Recall the commit history + + + + +
+ + + +
    +
  1. git-standup(1)
  2. +
  3. +
  4. git-standup(1)
  5. +
+ +

NAME

+

+ git-standup - Recall the commit history +

+ +

SYNOPSIS

+ +

git-standup [<full name>] [<since>] [<until>]

+ +

DESCRIPTION

+ +

Recall what you did on the last working day ..or be nosy and find what someone else did.

+ +

OPTIONS

+ +

<full name>

+ +

The author of commits. Defaults to $(git config user.name).

+ +

<since>

+ +

The start of commit history. Defaults to yesterday.

+ +

<until>

+ +

The end of commit history. Defaults to today.

+ +

EXAMPLES

+ +

This shows your commits since yesterday:

+ +
$ git standup
+
+a26d1f9 - add profile hook (69 minutes ago) <spacewander>
+
+ +

This shows the author's commits since last week:

+ +
$ git standup spacewander "last week"
+
+a26d1f9 - add profile hook (70 minutes ago) <spacewander>
+4e19859 - fix getTotalSize return value error (6 days ago) <spacewander>
+36da84e - fix rename over bound (7 days ago) <spacewander>
+8e4182a - add watermark.png (7 days ago) <spacewander>
+46fef1d - use tinyXML to configure (7 days ago) <spacewander>
+
+ +

If current directory is not a git repo, git-standup will fetch data from all top-level git repos under it:

+ +
$ cd ..
+$ git standup spacewander "last week" yesterday
+
+someProject/
+4e19859 - fix getTotalSize return value error (6 days ago) <spacewander>
+36da84e - fix rename over bound (7 days ago) <spacewander>
+8e4182a - add watermark.png (7 days ago) <spacewander>
+46fef1d - use tinyXML to configure (7 days ago) <spacewander>
+
+ +

AUTHOR

+ +

Originally from https://github.com/kamranahmedse/git-standup

+ +

REPORTING BUGS

+ +

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

+ +

SEE ALSO

+ +

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

+ + +
    +
  1. +
  2. April 2016
  3. +
  4. git-standup(1)
  5. +
+ +
+ + diff --git a/man/git-standup.md b/man/git-standup.md new file mode 100644 index 000000000..57ec3ea1a --- /dev/null +++ b/man/git-standup.md @@ -0,0 +1,66 @@ +git-standup(1) -- Recall the commit history +================================= + +## SYNOPSIS + +`git-standup` [<full name>] [<since>] [<until>] + +## DESCRIPTION + +Recall what you did on the last working day ..or be nosy and find what someone else did. + +## OPTIONS + +<full name> + +The author of commits. Defaults to `$(git config user.name)`. + +<since> + +The start of commit history. Defaults to `yesterday`. + +<until> + +The end of commit history. Defaults to `today`. + +## EXAMPLES + +This shows your commits since yesterday: + + $ git standup + + a26d1f9 - add profile hook (69 minutes ago) + +This shows the author's commits since last week: + + $ git standup spacewander "last week" + + a26d1f9 - add profile hook (70 minutes ago) + 4e19859 - fix getTotalSize return value error (6 days ago) + 36da84e - fix rename over bound (7 days ago) + 8e4182a - add watermark.png (7 days ago) + 46fef1d - use tinyXML to configure (7 days ago) + +If current directory is not a git repo, git-standup will fetch data from all top-level git repos under it: + + $ cd .. + $ git standup spacewander "last week" yesterday + + someProject/ + 4e19859 - fix getTotalSize return value error (6 days ago) + 36da84e - fix rename over bound (7 days ago) + 8e4182a - add watermark.png (7 days ago) + 46fef1d - use tinyXML to configure (7 days ago) + + +## AUTHOR + +Originally from https://github.com/kamranahmedse/git-standup + +## REPORTING BUGS + +<> + +## SEE ALSO + +<> diff --git a/not_need_git_repo b/not_need_git_repo index d941c3c21..4cc9c0622 100644 --- a/not_need_git_repo +++ b/not_need_git_repo @@ -4,3 +4,4 @@ git-alias git-extras git-fork git-setup +git-standup