我可以在git config中设置push-options(git push -o"...")吗? [英] Can I set push-options (git push -o "...") in git config?

查看:288
本文介绍了我可以在git config中设置push-options(git push -o"...")吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Git 2.10引入了git 推送选项( git push -o "my string").

Git 2.10 introduced git push options (git push -o "my string").

许多命令行选项都是可配置的,我想知道是否也可以这样做.我无法在 git-config 中找到它,但也许我忽略了它.

Many command line options are configurable, and I was wondering if it was possible for this too. I was not able to find it in git-config, but perhaps I'm overlooking it.

因此,是否可以添加(一组)默认推送选项以使...

So, would it be possible to add a (set of) default push option(s), to have ...

git push -o "r=joh.doe"

...运行时的默认设置...

... the default when running ...

git push

?

上下文: 我将其与Gerrit结合使用,直接将更改分配给审阅者(文档以供参考-使用兼容的语法<push-ref>%my_string).在上传许多更改并成对工作以相互检查彼此的代码时,如果我可以在推送时将该人添加为检查者,这将很有用.

Context: I am using this with Gerrit to directly assign changes to reviewers (documentation for reference - using compatible syntax <push-ref>%my_string). When uploading many changes and working in pairs to review each other's code it would be useful if I can add that person as reviewer at push-time already.

推荐答案

这已在Git 2.16中进行了配置(引用

This has become configurable in Git 2.16 (quoting release notes).

"git push"的"--push-option =选项现在默认为 通过push.pushOption变量配置的字符串列表.

The "--push-option=" option to "git push" now defaults to a list of strings configured via push.pushOption variable.

因此,当按照我的用例应用于Gerrit时,这应该可以将审阅者添加到john.doe并默认在发布时间发布草稿注释.

So, when applied to Gerrit as for my use case, this should work to add reviewer to john.doe and publish draft comments on push time by default.

git config --add push.pushOption r=john.doe
git config --add push.pushOption publish-comments

这篇关于我可以在git config中设置push-options(git push -o"...")吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆