简体   繁体   中英

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 (ie 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?

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM