Skip to content

Instantly share code, notes, and snippets.

@kdeloach
Created March 23, 2017 15:21
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 kdeloach/8091695ccac028faf635ac3eeacbebc4 to your computer and use it in GitHub Desktop.
Save kdeloach/8091695ccac028faf635ac3eeacbebc4 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Usage:
# ./find_merged_branches.sh 2>/dev/null | tee output.txt
TMPDIR="$PWD/tmp"
while read repo; do
rm -rf $TMPDIR
url="git@github.com:$repo.git"
git clone $url $TMPDIR 1>&2
pushd $TMPDIR 1>&2
branches=$(git br -a --merged | grep -Pv "develop|master|prototype" | xargs -0)
while read branch; do
if [ ! -z "$branch" ]; then
echo "$repo $branch"
fi
done <<< "$branches"
popd 1>&2
done < repos.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment