| #!/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