change default branch through API

Release notes

Change the API to support changing the default branch.

Problem to solve

While switching from master to main everywhere, it would be nice to have an automated way to complete this change transparently, from the client side, without users having to clickety their way through the settings page. One crucial part of this is missing from the API: the capacity of changing the default branch, without which it is impossible to cleanup the master branch.

Intended users

User experience goal

The user should be able to delete a default branch through the API or change the default branch of a repository.

Proposal

Unsure. Either a POST on the repository, or make an update on a branch?

Further details

This script otherwise works well to rename repositories with "normal" git remotes, but needs to go through all sorts of hoops with GitLab, and ultimately fails because it cannot delete the default branch:

https://gitlab.com/anarcat/scripts/-/blob/main/git-branch-rename-remote

Permissions and Security

Documentation

Availability & Testing

Available Tier

  • Free

What does success look like, and how can we measure that?

What is the type of buyer?

Is this a cross-stage feature?

Links / references

Edited by Antoine Beaupré