Every once in a while, it is necessary to perform a few housekeeping tasks to keep your git repository clean and efficient :
delete unused local branches
git branch -a
git branch -D unused_local_branch
delete unused remote branches
git push origin :unused_remote_branch
delete unused remote-tracking branches
If you use a shared-repository approach (several people have commit access to the same remote git repository), it will happen that someone else deletes a branch on the remote repository. Git does not automatically delete your local remote-tracking branches. To do so, it is necessary to :
git remote prune origin
clean-up unreachable commit objects
git prune
efficiently pack the repository objects
git gc –aggressive
That’s it
You probably should not advice people to use git gc –aggressive. Reason is in email from Linus.
http://gcc.gnu.org/ml/gcc/2007-12/msg00165.html