git 在命令行提交merge request

Note: Git push options are only available with Git 2.10 or newer.

For Git versions 2.10 to 2.17 use --push-option:

git push --push-option=<push_option>

For version 2.18 and later, you can use the above format, or the shorter -o:

git push -o <push_option>

Push options for GitLab CI/CD

You can use push options to skip a CI/CD pipeline, or pass environment variables.

Push optionDescriptionIntroduced in version
ci.skipDo not create a CI pipeline for the latest push.11.7
ci.variable="<name>=<value>"Provide environment variables to be used in a CI pipeline, if one is created due to the push.12.6

An example of using ci.skip:

git push -o ci.skip

An example of passing some environment variables for a pipeline:

git push -o ci.variable="MAX_RETRIES=10" -o ci.variable="MAX_TIME=600"

Push options for merge requests

You can use Git push options to perform certain actions for merge requests at the same time as pushing changes:

Push optionDescriptionIntroduced in version
merge_request.createCreate a new merge request for the pushed branch.11.10
merge_request.target=<branch_name>Set the target of the merge request to a particular branch.11.10
merge_request.merge_when_pipeline_succeedsSet the merge request to merge when its pipeline succeeds.11.10
merge_request.remove_source_branchSet the merge request to remove the source branch when it’s merged.12.2
merge_request.title="<title>"Set the title of the merge request. Ex: git push -o merge_request.title="The title I want".12.2
merge_request.description="<description>"Set the description of the merge request. Ex: git push -o merge_request.description="The description I want".12.2
merge_request.label="<label>"Add labels to the merge request. If the label does not exist, it will be created. For example, for two labels: git push -o merge_request.label="label1" -o merge_request.label="label2".12.3
merge_request.unlabel="<label>"Remove labels from the merge request. For example, for two labels: git push -o merge_request.unlabel="label1" -o merge_request.unlabel="label2".12.3

If you use a push option that requires text with spaces in it, you need to enclose it in quotes ("). You can omit the quotes if there are no spaces. Some examples:

git push -o merge_request.label="Label with spaces"
git push -o merge_request.label=Label-with-no-spaces

You can combine push options to accomplish multiple tasks at once, by using multiple -o (or --push-option) flags. For example, if you want to create a new merge request, and target a branch named my-target-branch:

git push -o merge_request.create -o merge_request.target=my-target-branch

Additionally if you want the merge request to merge as soon as the pipeline succeeds you can do:

git push -o merge_request.create -o merge_request.target=my-target-branch -o merge_request.merge_when_pipeline_succeeds

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ztenv

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值