I’m relatively new to Git, and want to get advice on best practices for deleting branches.
After I’ve created and merged a branch back into master, should I leave it hanging around for historical purposes, or should I delete it as soon as it’s no longer needed for housekeeping purposes?
Typically, you delete a branch after a merge.
For example, after the following merge, you would delete the branch
iss53, as you don’t need to develop from that branch anymore. You can later recreate it at any moment using the sha1 value of the commit bygit checkout -b <name> <sha1>.(Branches are only necessary when they point to commits that are “tips” of the tree. In fact, in that case, git won’t let you remove it, unless you force it to.)
(the image above comes from the excellent progit book)