git remote prune origin
This only deletes the remote references to these branches,
if they have been deleted on
origin - it doesn’t delete them locally.
It does however clean-up views you get of the current code, and removes some git cruft locally.
git branch --merged >/tmp/merged-git-branches && vi /tmp/merged-git-branches && xargs git branch -d >/tmp/merged-git-branches
This command lists your merged branches in Vim, and allows you to remove the ones you wish to keep (notably
Save and exit that temp file to then locally prune all the merged branches.
A simple run through of any unreferenced objects and unnecessary files to speed up merges and pushes.
Any object that is unreachable from a stored reference are deleted. If you’ve got a large repository and lots of rebasing going on, this will likely get large.
git gc will remove your
reflog history, which you might not want to do. So be sure you’re happy to lose that history.