Short lived branches are not deleted in the Cloud version


According to docs the short-lived branches should be deleted after 30 days. Unfortunately, it does not work (for me) - on my way too long list of short-lived branches there are positions annotated as “2 months ago”. I suspect it could be a bug.

Is ther a way to delete all short-lived branches at once?

The doc says that the branch TTL can be changed in “Configuration -> General -> Number of days before purging inactive short living branches” - I cannot find such option in the cloud version :frowning: are there dfferences between standard (on-premise) and cloud version?



I suspect the stale short-lived branches that are not getting deleted are not targeting the default branch of the project. Is that correct? Please confirm.

We’ve discovered a bug: the housekeeping job that deletes stale branches only affects branches depending on the default branch of the project.

I’m not aware of an easy way to bulk-delete stale branches. You can delete branches one by one using the UI, or using the Web API /api/project_branches/delete, possibly in combination with /api/project_branches/list to get a list of branch names filtered by type and analysis date.

Yes, it describes my case.
Thank you for investigating this issue.


What about the question
==> is there any dfference between SonarQube and SonarCloud regarding the branch TTL configuration as I cannot find such option in SonarCloud?
As per SonarCloud documentation: Short-lived branches are deleted automatically after 30 days with no analysis. This can be updated in Configuration > General > Number of days before purging inactive short living branches . Source:

any updates on this topic?

@janos This is still an issue, I keep having to go in and manualy clear out branches. The option to purge inactive branches in general setting just isnt there.

Any updates?

Still happening…
Are Sonar people aware of this?

We are very much aware. I don’t have a ticket number or a specific timeline, but based on related discussions, I think there’s a very good chance we will address this in the coming months. I will keep this thread posted when we have more news.


Thank you Janos!

thanks @janos waiting for your update here

Hello @janos
Any news on this? Just pushing for it.
Thank you!

Hi @JordiGiros, the news is that it seems pretty clear to me that we will address this as part of related work planned for Q1. Please stay tuned!

1 Like

Hi @saitv, @ghaouim, @Hobbit44, @JordiGiros, @baradana,

On closer look, this seems to be working to me: pull requests and short-lived branches older than 30 days are deleted. There is a catch though. This cleanup happens only when the project is analyzed (any branch / PR). If the project is not analyzed for a long time, there is no mechanism today to delete them.

If you have a project that has been analyzed recently, and pull requests or short-lived branches updated more than 30 days before that analysis were not deleted, then please let me know the project key so I can take a closer look. (If your project is private, then just let me know you have a good example, and I will start a private thread for your case.)