Rich
Rich

Reputation: 6561

What is the common or advised practice of keeping or deleting feature branches in git?

In my git repository I have a main branch that I've named master. Then I have feature branches that I use while developing, then merge those into master after the feature is finished. What is the common practice for the feature branches? Are all feature branches normally kept or deleted after code is merged into the master branch?

Upvotes: 1

Views: 151

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 521674

The feature branches actually exist, at first, both on your (and your coworkers') machine, as well as on the remote repository. Regarding the remote repository, there is a performance motivation to delete old branches no longer in use, especially if you have some kind of complex CI/CD setup there. So, best practice on the remote repository would likely be to delete old feature branches which are no longer relevant.

Regarding the feature branches on your own machine, even from a performance point of view, it is your decision alone as to what you want to do. I typically will keep my old feature branches around, just in case some issue might come up later on. In addition, because in our workflow old feature branches are removed from the remote, the versions on my machine are the only remnants of that work, so I tend to keep them around for this reason also.

Upvotes: 2

Related Questions