From http://www.darkcoding.net/software/cleaning-up-old-git-branches/
-
Switch to the main branch, usually 'develop':
git checkout develop
-
Get a list of fully merged branches:
git branch -a --merged
From http://www.aaronwest.net/blog/index.cfm/2011/6/7/Git-Workflows-Archiving-Old-Branches
-
Tag the unwanted branch:
git tag archive/sprintjuly2010 sprintjuly2010
-
Delete the branch:
git branch -d sprintjuly2010
-
Push the branch deletion to origin:
git push origin :sprintjuly2010
-
Push the new tag to origin:
git push --tags
-
Restore a deleted branch from a tag:
git checkout -b sprintjuly2010 archive/sprintjuly2010