Git Tricks: git-summary
Mercurial has a useful command, hg summary
, that prints out some basic information about your current repository status. git status
prints most of this information, but omits some useful details such as the ID and message of the most recent commit.
The following shell script will fix this, printing the current commit followed by the output of git status
:
#!/bin/sh
HEAD_REV=`git rev-parse --short HEAD 2>/dev/null`
if [ "$?" -ne 0 ]; then
exec git status
fi
HEAD_MSG=`git show -s --format=%s HEAD`
echo "Parent revision is $HEAD_REV: $HEAD_MSG"
exec git status
Save this script somewhere on your $PATH
as git-summary
(~/bin
is a good option). If you are on Windows, save it in a file called git-summary
in the usr\bin
subdirectory of your Git installation (often C:\Program Files\Git
). Then you can run git summary
to see this augmented display: