To show the commits I have staged that are ready to push I do
git log remotes/trunk~4..HEAD --pretty=format:"%C(yellow)%h%C(white) %ad %aN%x09%d%x09%s" --date=short | awk -F'\t' '{gsub(/[, ]/,"",$2);gsub(/HEAD/, "\033[1;36mH\033[00m",$2);gsub(/master/, "\033[1;32mm\033[00m",$2);gsub(/trunk/, "\033[1;31mt\033[00m",$2);print $1 "\t" gensub(/([\(\)])/, "\033[0;33m\\1\033[00m","g",$2) $3}' | less -eiFRXS
The output looks something like:
ef87da7 2013-01-17 haslers (Hm)Fix NPE in Frobble
8f6d80f 2013-01-17 haslers Refactor Frobble
815813b 2013-01-17 haslers (t)Add Wibble to Frobble
3616373 2013-01-17 haslers Add Foo to Frobble
3b5ccf0 2013-01-17 haslers Add Bar to Frobble
a1db9ef 2013-01-17 haslers Add Frobble Widget
Where the first column appears in yellow, and the 'H' 'm' and 't' in parentesis show the HEAD, master and trunk and appear in their usual "--decorate" colors
Here it is with line breaks so you can see what it's doing:
git log remotes/trunk~4..HEAD --date=short
--pretty=format:"%C(yellow)%h%C(white) %ad %aN%x09%d%x09%s"
| awk -F'\t' '{
gsub(/[, ]/,"",$2);
gsub(/HEAD/, "\033[1;36mH\033[00m",$2);
gsub(/master/, "\033[1;32mm\033[00m",$2);
gsub(/trunk/, "\033[1;31mt\033[00m",$2);
print $1 "\t" gensub(/([\(\)])/, "\033[0;33m\\1\033[00m","g",$2) $3}'
I have aliased to "staged" with:
git config alias.staged '!git log remotes/trunk~4..HEAD --date=short --pretty=format:"%C(yellow)%h%C(white) %ad %aN%x09%d%x09%s" | awk -F"\t" "{gsub(/[, ]/,\"\",\$2);gsub(/HEAD/, \"\033[1;36mH\033[00m\",\$2);gsub(/master/, \"\033[1;32mm\033[00m\",\$2);gsub(/trunk/, \"\033[1;31mt\033[00m\",\$2);print \$1 \"\t\" gensub(/([\(\)])/, \"\033[0;33m\\\\\1\033[00m\",\"g\",\$2) \$3}"'
(Is there an easier way to escape that? it was a bit tricky to work out what needed escaping)