Force a branch naming convention in Azure DevOps Git

匆匆过客 提交于 2019-12-05 04:28:51
Marina Liu

There are two kinds of git hooks:

  • Client-side hooks, works for the local git repo.
  • Server-side hooks, works for the remote repo (VSTS git repo as you used).

More details about git hooks, you can refer Customizing Git - Git Hooks in git book.

For now, only client-side hooks (such as pre-push hook, pre-commit hook etc) are supported for VSTS git repo.

The Server-side hooks is not available for now (but already in our backlog) for VSTS git repo, you can also find it in this user voice. Once server-side hooks are available in future, such as you can use pre-receive hook (or post-receive hook) to check and force convert branch name in remote repo.

Besides, the link in your question is using VSTS web hook which is quite different from git hooks. And of course you can check and force convert branch name by web hook, but you additional website to receive information and convert branch name. Detail steps as below:

Add a web hook in VSTS service Hooks Tab -> Trigger by code push event -> input your own website url -> Test -> make sure it can connect successful -> Finish.

Once new changes are pushed to VSTS git repo, the web hook will be triggered, and send information to your website. Then you can check and convert branch name in your website and push again.

TFS 2018 and Azure Repos allow you to require branches be created in folders.

See https://docs.microsoft.com/en-us/azure/devops/repos/git/require-branch-folders?view=azure-devops for instructions how to configure permissions to enable this.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!