microsoft / terraform-provider-azuredevops

Terraform Azure DevOps provider
https://www.terraform.io/docs/providers/azuredevops/
MIT License
387 stars 280 forks source link

feat request: create empty branch #768

Open Sebast1aan opened 1 year ago

Sebast1aan commented 1 year ago

Community Note

Description

When currently creating a new branch via resource azuredevops_git_repository_branch, it seems not possible to create an empty branch that is not based on another branch/tag/commit.

New or Affected Resource(s)

Sebast1aan commented 1 year ago

If this is a valid use case in general, I can give this one a try to implement (although my current golang knowledge is limited)

xuzhang3 commented 1 year ago

@Sebast1aan Are you trying create a branch totally new without any commit without any history commits? From my experience it is possible to create a branch like this

Sebast1aan commented 1 year ago

To explain the use case: I want to add a pipeline to multiple repositories via terraform. The yml file for the pipeline should be placed in a new branch inside each repository, preferably with no other file inside that branch. Since none of these repositories currently have a good default branch to start from, I always end up with a new branch that contains too much code from the original branch.

If see alternative ways to achieve this, that's also fine.

Regarding creating empty branches, I found following stackoverflow questions: https://stackoverflow.com/questions/34100048/create-empty-branch-on-github Not sure if it works in practice however.

xuzhang3 commented 1 year ago

@Sebast1aan Empty branch can be created via API.