HEAD 的 git 别名:refs/for/master
我正在配置 Gerrit
并且我想避免写:
git push gerrit HEAD:refs/for/master
我想写:
git push review
我确信可以修改 .git/config
但我无法让它工作。
I am configuring Gerrit
and I would like to avoid writing:
git push gerrit HEAD:refs/for/master
I would like to write:
git push review
I am sure it's possible modifying .git/config
but I can't make it work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您可能还对 git-review 感兴趣,它不仅消除了
push
只需提供:... 但也可以让您执行以下操作:
查看上面链接上的“使用”部分以了解更多信息。
You might also be interested in git-review, which not only eliminates the
push
by simply providing for:... but also lets you do things like:
Checkout the Usage section on the link above for more.
也许不是您要寻找的内容,但是如果您:
gerrit
评论
(使用git Remote Rename Rename gerrit评论
),git config push.default跟踪
和git config branch.master.merge refs/for/master
,然后您可以
git push push评论
和您的主将在Gerrit上推到refs/for/master
。而且,顺便说一句,如果您
git config branch.master.master.remote评论
,则可以git push
并获得相同的东西。Maybe not exactly what you're looking for, but if you:
gerrit
toreview
(withgit remote rename gerrit review
),git config push.default tracking
, andgit config branch.master.merge refs/for/master
,then you can
git push review
, and your master will be pushed torefs/for/master
on gerrit.And, incidentally, if you
git config branch.master.remote review
, then you can justgit push
and get the same thing.如果您想允许直接推送到 refs/heads/ 中的分支,您只需在 gerrit web gui 中添加一个权限:
你完成了。
And if you want to allow direct push to branch in refs/heads/ you simply add a right in gerrit web gui:
youre done.
如果您只想通过 gerrit 推送到 master 分支,请将以下内容添加到
.git\config
或在项目目录中执行,
然后您就可以使用
推送到 Gerrit。使用此方法,您可以从任何本地分支推送,并且数据将始终发送到主分支
Those of you who want to push only to master branch through gerrit, add the following to
.git\config
or execute in project dir
Then you can use
to push to Gerrit. Using this method you can push from any of your local branches and the data will always go to master branch
您好,只需创建一个简单的脚本来自动化该过程:
您将使用为:
并选择您需要配置的不同组。
Hi just create a simple script to automate the process:
You will the use as:
And select the different group you need to configure.
我设置了两种不同的推送类型,review 和 noreview:
用于审核:
绕过审核:
请注意,项目所有者/Gerrit 管理员需要进行一些 Gerrit 项目更改才能绕过审核。我认为需要将“推送”权限添加到 refs/* 的项目中(除非您具体了解允许绕过审查的分支)。但是,对于评论,发布所需的权限已经设置好。换句话说,如果您
正在工作,那么上面的“审查”部分也应该可以工作,而无需更改任何其他内容。
I set up two different push types, review and noreview:
for reviews:
to bypass review:
Note that there are some Gerrit Project changes that need to be made by the Project Owner/Gerrit Admin in order to bypass a review as well. I think the "Push" permission will need to be added to the project for refs/* (unless you're getting specific about what branch you'll allow bypassing the review in). However, for reviews, the permissions needed to post in will already be set up. In other words, if your
is working, than the "review" part above should work as well without changing anything else.
你最好做的就是在你的别名中添加一个 Git scriptlet。类似这样的东西基于“上游”分支工作,尽管我想稍微清理一下:
~/.gitconfig
这样,您可以简单地键入:
,就像您键入的一样:
或
的唯一要求这是因为它仅与 Windows 上的 Git Bash shell 或众多 Linux shell 之一兼容。
What you're best off doing is a Git scriptlet in your alias. Something like this works based on the 'upstream' branch, although I'd like to clean this up a little bit still:
~/.gitconfig
This way, you can simply type:
and it's just like you typed:
or
The only requirement for this is that it is only compatible with the Git Bash shell on Windows, or one of the many Linux shells.
为什么不创建 bash 别名?
现在您只需输入:
如果您想在多个多个 gerrit 分支上工作,请检查我的 bash 助手:https://github.com/tomwys/gerrit-bash-commands
Why don't create bash alias?
Now you can just type:
If you want to work on more than one gerrit branch, check my bash helpers for that: https://github.com/tomwys/gerrit-bash-commands