forked from tj/git-extras
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request tj#525 from spacewander/git-standup
add git standup
- Loading branch information
Showing
6 changed files
with
411 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [<full name>] [<since>] [<until>] | ||
. | ||
.SH "DESCRIPTION" | ||
Recall what you did on the last working day \.\.or be nosy and find what someone else did\. | ||
. | ||
.SH "OPTIONS" | ||
<full name> | ||
. | ||
.P | ||
The author of commits\. Defaults to \fB$(git config user\.name)\fR\. | ||
. | ||
.P | ||
<since> | ||
. | ||
.P | ||
The start of commit history\. Defaults to \fByesterday\fR\. | ||
. | ||
.P | ||
<until> | ||
. | ||
.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) <spacewander> | ||
. | ||
.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) <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> | ||
. | ||
.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) <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> | ||
. | ||
.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> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.