Skip to content

Instantly share code, notes, and snippets.

@rjp
Created January 30, 2011 21:16
Show Gist options
  • Save rjp/803258 to your computer and use it in GitHub Desktop.
Save rjp/803258 to your computer and use it in GitHub Desktop.
if ! git status >/dev/null 2>/dev/null ; then
echo "not a git repository"
exit 128
fi
B=/tmp/.lnt.branches
T=/tmp/.lnt.tracking
# first we find our local branches
git branch --no-abbrev --no-color | cut -b3- | sort > $B
# do we have any remotes?
rc=$(git remote | wc -l)
if [ $rc -gt 0 ]; then
git fetch --dry-run --all -v 2>&1 | grep -- '->' | cut -b22- | sed -e 's/ *->.*$//' | sort > $T
else
:>.tracking
fi
echo "local branches not tracking remotes:"
comm -2 -3 $B $T
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment