+12

Have an option to delete all branches that are already merged to master

Michael Tsibelman 3 years ago updated by Thomas Singer 4 months ago 8

Where you want to get this option? In the Merge command?

+1

The scenario I have in mind is that we have, many developer who work on the features and merge them into master or develop branches they sometime forget to delete their branch on the origin, after sometime we get a tree of branches that are no longer needed and making a mess, ideally I would like to have an ability to right click on some branch and say show me all branches that are merged to it but still exists and to have an option to check some or all of them and to delete them. Hope I make sense.

SmartGit already marks branches that don't exist in origin (have been deleted) in red. Maybe have a user-defined threshold for how old a fully-merged branch should be before it is marked in a different color to indicate it can be deleted. Let's say, any branch that is fully-merged into develop and it's last commit is older than two weeks will be marked in this way, so you know it's probably safe to delete.


Alternatively, you could have a separate "Clean up old branches" UI that can show fully-merged branches and how long ago their last commit was ("27 days ago") and have a checkbox next to each other and a "Delete selected" button. It might have additional controls to show old un-merged branches too ("abandoned"). It could also show un-merged feature branches that have strayed too far from develop that need integration ("4 days old, 67 commits behind develop").


But I think the core need to cleanup fully-merged, forgotten branches will give the most value.

When was this branch color feature added ? I face the problem many times and it never occured to me "orphan" branches changed colors ? And I use last build since quite some time now...

+1

Pierre, when a branch that exists locally is deleted from 'origin' and I fetch/pull (in this case "QuietLog"), that's how it looks for me:


I'm using SmartGit 17.0.2 #10105, but this feature has been around for a while.

Just tested, this is working great indeed ! Event if I pull from another branch. Here is what I get :

Background operations doesn't seem to trigger this red label though...

+1

Just for your information.

When you pull, behind the scenes it does a "fetch & merge"

The 'fetch' acts on the whole repo. Not an individual branch. (except for shallow clones)

It is the merge part that only happens on a single branch.

Hope this helps.