git – Should I delete a branch after merging it?


After merging a branch, do you delete it from the repository?
Is it a good practice or not?
I usually create a lot of branches, since I don’t want to break my current release, and I’d wish to delete them to keep things in order.
However, if you work with Assembla or GitHub, your merge requests from old branches will be saved on the site, so if you delete them you’ll get an error since it won’t be able to fetch them…

Usually how do manage that?


There’s no problem in deleting branches that have been merged in. All the commits are still available in the history, and even in the GitHub interface, they will still show up (see, e.g., this PR which refers to a fork that I’ve deleted after the PR got accepted).

Leave a Reply