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/