Ken Liu
Ken Liu

Reputation: 22914

Delete an (unmerged) Git branch when it is no longer active?

I have some maintenance branches in Git that were used to create emergency releases (i.e. to fix a critical bug in production). These branches are usually not merged back to master, because they either contain one-off fixes or have changes that were cherry-picked from master.

As a matter of practice, should these maintenance branches be deleted in Git if they are tagged (at build time)? Will deleting them cause those commits to be lost?

Upvotes: 5

Views: 3216

Answers (1)

Useless
Useless

Reputation: 67733

No commit will be lost if it's reachable from a tag or a branch head.

If you tagged a branch, and then made another commit, and then deleted the branch, that last commit would be liable to garbage collection (at some point in the future - you can still recover it using reflog if you don't wait too long).

Upvotes: 3

Related Questions