简体   繁体   English

如何一次在多个gerrit项目中创建分支

[英]How to create branch in multiple gerrit projects at once

I have around 200 Gerrit projects.我有大约 200 个 Gerrit 项目。 In that 70 repositories contains prefix as (network).在这 70 个存储库中包含前缀为(网络)。 I need to create a new branch let's say(dev_branch) once in all 70 (network) related repositories.我需要在所有 70 个(网络)相关存储库中创建一个新分支让我们说(dev_branch)一次。 So locally clone them all 70 repositories then creating branch is best way or other feasible way available with git/gerrit?因此,在本地克隆所有 70 个存储库,然后创建分支是最好的方法还是其他可用的 git/gerrit 可行方法? Any direction would be appreciated.任何方向将不胜感激。

The best way to do this is using the Create Branch REST API endpoint.最好的方法是使用Create Branch REST API 端点。

For example, you can create a "develpment" branch in the project "sandbox/helloword" by executing:例如,您可以通过执行以下命令在项目“sandbox/helloword”中创建一个“develpment”分支:

curl -s --user USER:PASS --request PUT --data @- --header Content-Type:application/json https://GERRIT-SERVER/a/projects/sandbox%2Fhelloworld/branches/development << EOF
{
    "revision": "INITIAL-REVISION"
}
EOF

INITIAL-REVISION can be a SHA number, a branch name or HEAD. INITIAL-REVISION 可以是 SHA 编号、分支名称或 HEAD。

You'll need to execute the above command for each "network" repository.您需要为每个“网络”存储库执行上述命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM