Skip to content

Instantly share code, notes, and snippets.

@grimreaper
Forked from gabro/git-working-history
Created April 21, 2016 16:21
Show Gist options
  • Save grimreaper/bafaf6a7a6aea39e317423ff90793429 to your computer and use it in GitHub Desktop.
Save grimreaper/bafaf6a7a6aea39e317423ff90793429 to your computer and use it in GitHub Desktop.
Github-like working directory history
#!/bin/bash
FILES=`git ls-tree --name-only HEAD .`
MAXLEN=0
IFS=$(echo -en "\n\b")
for f in $FILES; do
if [ ${#f} -gt $MAXLEN ]; then
MAXLEN=${#f}
fi
done
for f in $FILES; do
str=$(git log -1 --pretty=format:"%C(green)%cr%Creset %x09 %C(cyan)%h%Creset %s %C(yellow)(%cn)%Creset" $f)
printf "%-${MAXLEN}s -- %s\n" "$f" "$str"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment