Should I delete a branch after it merges?

After merging a branch, do you delete it from the repository?
However, is this a good practice or not?

I usually create many branches, since I do not want to break the current version, and I would like to delete them so that everything is in order.
However, if you are working with Assembla or GitHub, your merge requests from the old branches will be saved on the site, so if you delete them, you will receive an error message, as it will not be able to receive them ...

How do you usually do this?

+68
git branching-and-merging
May 26 '12 at 10:07
source share
2 answers

No problem removing branches that have been merged. All commits are still available in the history and even in the GitHub interface, they will still be displayed (see, for example, this PR , which refers to the fork that I deleted after the PR was accepted).

+50
May 26 '12 at 10:14
source share
β€” -

I definitely clean my branches after they have been merged.

We use GitLab and execute merge requests, so historical branch information is stored there; I don’t need them, cluttering the list of my branches, and when I look at a colleague’s fork, I would only like to see the branches of their current active development. If I try to look at some code on my branch, I want to be able to view only a few active branches, and not every function or fix that they have ever started working with.

The above also applies to BitBucket and GitHub.

The only reason you might not have to remove the branch after the merge is because you know where the function ended, but the merges do (and git merge --no-ff if you really want to) make it inappropriate.

+18
May 26 '12 at 13:49
source share



All Articles