I am working on a project with my team, we use master
as our stable branch, and dev
for new features that have been implemented but are being tested before we merge the changes into master
. I created a branch from dev
called new-feature-1
, and made several commits on this branch, making sure to push these changes to our remote along the way. I have now completed my work on new-feature-1
and I merge it with to dev
, it gets accepted and merged with master
. The feature has been implemented and I no longer have need for new-feature-1
as a branch, but it's on both my local machine, and more importantly the remote.
What is usually done in a scenario like this? Do I delete new-feature-1
and force push the deletion to remote? Or is it standard practice to leave it there? What do most people/companies do in this scenario?
Keep in mind that a branch is nothing but a snippet of text, commonly known as a name. That is all your branch ever was. The reason you need a branch is because a commit that neither has a name nor is the parent (at some depth) of a commit with a name, is unreachable and will eventually die. So if you
Do not need to reach the commits on this branch, or
Can reach all the commits on this branch that you need to, because the branch was merged into another branch
then the name serves no purpose and should be deleted, as it merely clutters up the namespace.
[Alternate metaphor:] Think of a branch as a bookmark. It holds your place while you work. When you're done working, you don't need the bookmark any more; there is no place to hold.