Skip to content

Instantly share code, notes, and snippets.

@aanand
Created August 17, 2009 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aanand/169393 to your computer and use it in GitHub Desktop.
Save aanand/169393 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -o errexit
BRANCH=$(git branch | grep '*' | awk '{ print $2; }')
git fetch
for branch in $(ls .git/refs/heads)
do
if [ -f .git/refs/remotes/origin/$branch ]
then
if git diff --quiet $branch remotes/origin/$branch
then
echo "$branch is up-to-date."
else
git checkout $branch
git rebase origin/$branch
fi
fi
done
git checkout $BRANCH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment