Created
September 18, 2014 15:03
-
-
Save seanburlington/1044fa822f971a2828da to your computer and use it in GitHub Desktop.
List a git directory with last commit details (like github does)
This file contains hidden or 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
#!/bin/bash | |
FILES=`ls -Atc` | |
MAXLEN=0 | |
for f in $FILES; do | |
if [ ${#f} -gt $MAXLEN ]; then | |
MAXLEN=${#f} | |
fi | |
done | |
for f in $FILES; do | |
ago=$(git log -1 --decorate --pretty=format:"%C(green)%cr%Creset" $f); | |
#ago=$(git log -1 --decorate --pretty=format:"%C(cyan)%h%Creset" $f); | |
commithash=$(git log -1 --decorate --pretty=format:"%C(cyan)%h%Creset" $f); | |
user=$(git log -1 --decorate --pretty=format:"%C(yellow)(%cn)%Creset" $f); | |
message=$(git log -1 --decorate --pretty=format:"%s" $f); | |
printf "%-${MAXLEN}s -- %30s %10s %-30s %.80s \n" "$f" "$ago" "$commithash" "$user" "$message"; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment