Created
June 24, 2010 11:48
-
-
Save herzi/451351 to your computer and use it in GitHub Desktop.
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 | |
if ! git rev-parse --git-dir > /dev/null; then | |
echo "This is not a git directory" | |
exit 1 | |
fi | |
if test $# -lt 1; then | |
remote=origin | |
else | |
remote=$1 | |
fi | |
git ls-remote $remote | while read LINE; do | |
commit=`echo $LINE | sed 's/ .*//'` | |
name=`echo $LINE | sed 's/.* //'` | |
if [ -z $name ]; then | |
continue; | |
fi | |
case $name in | |
refs/heads/master) | |
continue | |
;; | |
refs/heads/*) | |
shortname=`echo $name | sed 's@.*/@@'` | |
if ! git log --max-count=1 --pretty=format:"Branch '$shortname' -- last commit was %ar by %an (%h)" $commit 2>/dev/null; then | |
echo "your checkout doesn't contain commit `echo $commit | sed 's/^\(.......\).*/\1/'` for branch $shortname" | |
exit 1 | |
fi | |
;; | |
esac | |
done | |
# vim:set et sw=8: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment