Description ====================== Find and delete old git branches that are no longer needed. Usage ====================== 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 # schiang@comverge.com git branch -d remove_new_relic # 301a52b (5 hours ago) git branch -d something # 301a52b (5 hours ago) $ git old-branches github/master | format_branch_deletes # schiang@comverge.com git push github :30434977_fix_the_clock # a262408 (3 weeks ago) git push github :add_non_existant_methods # f47c5c9 (10 days ago) git push github :manual_requires # c9bcc3f (3 weeks ago) git push github :unnecessary_fsr # 54f4eb4 (9 days ago) 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