DEV Community

Discussion on: Do you delete Git branches?

Collapse
 
ahferroin7 profile image
Austin S. Hemmelgarn

As a general rule, delete them completely, but embed the relevant info in the commits (either the merge commit if you use one, or the commits of the branch itself if you don't) to link things to your issue tracker (see for example how GitHub handles lines of the form Fixes: #XXXX in commits, when the commit is merged the referenced issue is closed and retains a link to the commit that closed it).

Having too many branches actually has a negative impact on git performance (it's not much unless you have really crappy storage (or are stuck using WSL1), but it's there) and repository size (bigger impact here), even aside from the issue of finding specific branches.