Forked from anonymous/git-remove-orphan-svn-branches.sh
Created
March 21, 2013 23:49
-
-
Save dtjm/5217872 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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