Skip to content

Instantly share code, notes, and snippets.

@seanburlington
Created September 18, 2014 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanburlington/1044fa822f971a2828da to your computer and use it in GitHub Desktop.
Save seanburlington/1044fa822f971a2828da to your computer and use it in GitHub Desktop.
List a git directory with last commit details (like github does)
#!/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