Skip to content

Instantly share code, notes, and snippets.

@humus
Created September 15, 2015 03:43
Show Gist options
  • Save humus/f47261f1f29eebbd732b to your computer and use it in GitHub Desktop.
Save humus/f47261f1f29eebbd732b to your computer and use it in GitHub Desktop.
Git useful aliases
[alias]
l = "!. ~/.pretty_log"
s = status -uno --short
qamend = commit --amend --no-edit
#!/bin/bash
HASH="%C(yellow)%h%C(reset)"
RELATIVE_TIME="%C(green)%ar%C(reset)"
AUTHOR="%C(dim white)%ae %C(reset)"
REFS="%C(red)%d%C(reset)"
SUBJECT="%s"
FORMAT="$HASH¬$RELATIVE_TIME¬$AUTHOR¬$REFS $SUBJECT"
ARGS="-10"
if [ "$#" != "0" ]; then
ARGS=$*
fi
pretty_git_log() {
git log --graph --pretty="tformat:$FORMAT" $* |
sed 's/ ago\>\|@[^[:space:]]\+//g' | sed 's/years \d* months/years/' |
sed 's/\(.\{4\}[^[:digit:]][[:digit:]]\)[[:space:]]\+\(days\|weeks\|months\|hours\|minutes\|seconds\)/ \1 \2/' |
sed 's:origin/:/:g'|
column -t -s '¬' |
cut -c1-"$((`tput cols`+34))" |
less -RFXS
}
pretty_git_log $ARGS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment