Is there a way to trigger the creation of branches when a new repository is created in Azure Git?
I know we can automate the creation of an azure git repository and then create the branches via powershell. However, we have developers that will eventually create their own repositories and it would be nice if we could automatically see the new repository and then create a development, release and hotfix branch.
I am not aware of any setting in Azure DevOps that would automatically create a set of default branches for repositories.
As a way to create this solution yourself, you can create some type of automation that triggers on a timer set to a frequency of your choice. You can store this logic in:
The logic of the automation can use these two APIs:
You can call the list repositories API to return a list of repositories. You can then iterate through the list of repositories and call the list branches API for each. Check if your desired list of branches exist, and if not, create them using git.