Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Get and set default branch in v2 API

Emilio Ziniades
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 12, 2023

In the v2 API, how do I get and set default repository branches?

It is possible in v1 API, but that has now been deprecated. There are over 50 repositories, so it is not feasible to do manually.

1 answer

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
July 13, 2023

Hello @Emilio Ziniades and welcome to the Community!

To update repository settings you would usually need to leverage the Update a repository API endpoint. However, I'm afraid that updating the main branch is currently not supported on that endpoint. We do have an open feature request to implement this functionality : 

I would suggest adding your Vote on that feature request to give it traction, and also mark yourself as a Watcher to receive first-hand updates whenever there's any progress on its implementation.

While that feature is not available, you can change the main branch of a repository on the UI by navigating to Repository Settings > Repository Details > expand Advanced > Main branch.

Thank you, @Emilio Ziniades !
Patrik S

Emilio Ziniades
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
July 14, 2023

Hey @Patrik S , thanks for the feedback. I have voted for the above issue.

Like Patrik S likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events