Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dtjm/5217872 to your computer and use it in GitHub Desktop.
Save dtjm/5217872 to your computer and use it in GitHub Desktop.
$REPO=`git svn info | grep "Repository Root: " | sed -e 's/Repository Root: //'`
git branch -r | sed 's|^[[:space:]]*||' | grep -v '^tags/' > git-branch-list
svn ls $REPO/branches | sed 's|^[[:space:]]*||' | sed 's|/$||' > svn-branch-list
diff -u git-branch-list svn-branch-list | grep '^-' | sed 's|^-||' | grep -v '^trunk$' | grep -v '^--' > old-branch-list
for i in `cat old-branch-list`; do git branch -d -r "$i"; rm -rf .git/svn/refs/remotes/"$i"; done
rm -v old-branch-list svn-branch-list git-branch-list
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment