Question

I know how to delete remote branches, so this question isn't: cleaning up old remote git branches or how to manage obsolete branches on github

Rather, my problem is that deleting old feature branches will lose the commit messages and with them, the JIRA issue tags within. Thus we'll no longer be able to see the commits made against a given issue from JIRA.

Is there any way to clean up, close or hide remote branches from the git branch -a listing, but not destroy the messages we need for JIRA's git plugin to do its thing?

Was it helpful?

Solution

A branch in git is just a pointer to a specific revision. When you delete a branch, you're not deleting any commits. Instead, the branch ref in refs/heads/<branch_name> is deleted. At this point, all the commits are still there. If there are no other references to the commits, then they will eventually be pruned by git gc (not sooner than 30 days, by default).

However, you presumably are merging these feature branches somewhere else. As long as this is true, deleting the old feature branch won't lose anything other than the branch ref.

If you aren't really merging these feature branches for some reason, then I'm not sure what the point to keeping them is. You could tag them, and delete the branch, if you're okay with lots of extra tags, but not lots of branches.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top