Created
August 31, 2011 17:20
-
-
Save maw/1184105 to your computer and use it in GitHub Desktop.
outputs the sha1 of the last commit, plus whether the repo is in a dirty state or not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
last=$(git log -1 --format="%h"); | |
status=$(git status --porcelain | grep '^ M' | head -n 1) | |
if [ x"" = x"$status" ]; then | |
maybe_dirty="" | |
else | |
maybe_dirty="-dirty" | |
fi | |
echo $last$maybe_dirty |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment