Find and delete old git branches that are no longer needed.
Clone the repo and add to your path (just for ease of use):
git clone git://gist.github.com/2891516.git gist-2891516
cd gist-2891516
export PATH="$PATH:$(pwd)"
Now go to your project.
# list branches that have been merged to the current branch
git old-branches
# list branches that have been merged to the remote:
git old-branches github/master
# format branch delete commands according to user:
git old-branches github/master | format_branch_deletes
Example output:
$ git old-branches | format_branch_deletes
# [email protected]
git branch -d remove_new_relic # 301a52b (5 hours ago) <[email protected]>
git branch -d something # 301a52b (5 hours ago) <[email protected]>
$ git old-branches github/master | format_branch_deletes
# [email protected]
git push github :30434977_fix_the_clock # a262408 (3 weeks ago) <[email protected]>
git push github :add_non_existant_methods # f47c5c9 (10 days ago) <[email protected]>
git push github :manual_requires # c9bcc3f (3 weeks ago) <[email protected]>
git push github :unnecessary_fsr # 54f4eb4 (9 days ago) <[email protected]>
The idea is that you can check the delete commands and execute as needed. Note that once the remote branches are deleted your teammates may have to prune the deleted branches from their local copies:
# use --dry-run option first as a precaution
git remote prune github