Bitbucket-Server: Delete branch programmatically in plugin?

Hi guys,

i am wondering if and how i can delete a branch after merging it programmatically. I tried multiple things but they didn’t work out. So i am wondering if it even is possible via the java api or so.

I need this, because we want do define our own work-flow in bitbucket for our company. This includes a functionality that allows the user to merge all pull-requests from different repositories that have the same “From”->“To” Branches. (pls dont ask why ^^’)

So if anyone can help that would be great.

Yannik

factory.builder(repository).branch().delete(ref).force(true).build().call()

factory is instance GitCommandBuilderFactory
ref is branch name like master

2 Likes