Can we try not deleting branches right after PR merges?

This is just an idea, but I'm hoping we can give it a try. I've recently noticed that I have a million local git branches of vanilla/vanilla and my usual cleanup script hasn't been getting rid of them. I think the issue is being caused by the fact that we delete branches on github immediately after merges. That means that my localhost never knows that a tracking branch was merged into master.

What I was hoping we could do is leave merged branches around and then do a cleanup every once in a while on github. This would allow local repos to fetch the merge info from the remotes and then run cleanup scripts.

As an FYI, I have a local alias that runs the following commands:

git remote prune origin
git branch --merged | grep -v "\*" | egrep -v "master|development" | xargs -n 1 git branch -d

Comments

  • FWIW, that's always been my approach. I leave branches and do a bi-monthly-ish sweep thru the repos to catch dead branches.