Skip to content

Instantly share code, notes, and snippets.

@tommeier
Created November 9, 2010 02:00
Show Gist options
  • Save tommeier/668606 to your computer and use it in GitHub Desktop.
Save tommeier/668606 to your computer and use it in GitHub Desktop.
Analyse your remote branches in origin (run in a git repo, with remote of origin)
function analyse_remote_branches {
printf "\n\n== Loading remote branches..\n"
git gc --prune=now
git remote prune origin
git for-each-ref --shell --format="%(refname)" refs/remotes/origin | \
while read branch
do
branch_name=${branch/refs\/remotes\/origin\//}
printf "\nRemote Branch : ${branch_name}\n"
result=`git log master..origin/${branch_name//\'/} --pretty=format:" -------> %h | %ar | %an | %s" --abbrev-commit --date-order --decorate -n 4`
if [ "$result" == "" ]; then
echo " <--> Commits all merged in master"
else
echo " --> Commits not in master : "
printf "$result\n"
fi
echo "---"
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment