git - 我可以在 git config 中设置推送选项(git push -o "...")吗?

标签 git gerrit git-push git-config

Git 2.10 引入了 git push options (git push -o "my string")。

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

那么,是否可以添加(一组)默认推送选项,使其具有...

git push -o "r=joh.doe"

...运行时默认...

git push

?

上下文: 我将其与 Gerrit 一起使用以直接将更改分配给审阅者( documentation for reference - 使用兼容语法 <push-ref>%my_string )。当上传许多更改并结对工作以审查彼此的代码时,如果我可以在推送时间将该人添加为审阅者,将会很有用。

最佳答案

这在 Git 2.16 中已变得可配置(引用 release notes)。

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

因此,当在我的用例中应用于 Gerrit 时,这应该可以将审阅者添加到 john.doe 并默认在推送时间发布评论草稿。

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

关于git - 我可以在 git config 中设置推送选项(git push -o "...")吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46217528/

相关文章:

eclipse - EGit - SSH 密码失败(连接到 GitHub 时)

jenkins - 如何从 jenkins gerrit trigger 对自定义标签进行投票?

git - git push 上的 "src refspec does not match"和 "failed to push some refs"错误

php - 有没有办法让 git diff 显示方法名而不是类名?

Git - 我可以推/pull 但不能克隆

git - digital ocean ,Ubuntu Droplet - 使 : *** No rule to make target `all' . 停止

gerrit - 如何订阅 gerrit 项目?

git - Gerrit 代码审查推送到空 repo 不起作用

git - 如何撤消分支推送到 master

git pull 与 git push -f 类似/相反?