Gerrit rebase 本地分支与上游 master

Gerrit rebase local branch with upstream master

我需要一些帮助来将社区 rebased 分支推送到我们的 gerrit。

我们有一个从社区项目中分叉出来的项目。早些时候我们没有使用 gerrit,所以 rebase 和 push 很容易。但是现在有了 gerrit,事情让我感到困惑。

我需要将我们分叉的发布分支与上游发布分支重新绑定。

这是我到目前为止所做的

git checkout -b local_zoomba1 remotes/origin/zoomba1
git remote add upstream <upstream git repo>
git fetch upstream
git rebase remotes/upstream/stable/zoomba1

在此之后,我解决了一些冲突。然后添加一个空提交来标记 rebase

git commit --allow-empty -m "Rebased with community zoomba1 release"

现在乐趣开始了:)

当我做 git 审查时,它给出了提交者邮件 ID 与我的 ID 不匹配的错误。所以我允许 'Forge Committer' 和 'Forge Author'

现在它显示了所有提交,但最后抱怨:

You are about to submit multiple commits. This is expected if you are
submitting a commit that is dependent on one or more in-review
commits. Otherwise you should consider squashing your changes
into one commit before submitting.

The outstanding commits are:
...
...
Type 'yes' to confirm, other to cancel: yes
remote: Processing changes: refs: 1, done
remote: ERROR: missing Change-Id in commit message footer
remote:
remote: Hint: To automatically insert Change-Id, install the hook:
...
remote: And then amend the commit:
remote:   git commit --amend
remote:

当然,您可以在一次大提交中压缩所有社区提交,然后将 Change-Id 放在上面,但这不是最好的做法。我认为,在这种情况下,您不想审查所有社区提交,对吗?这个任务没有意义。因此,最好的方法是绕过 Gerrit 直接推送到分支。如何做到这一点?

1) 您需要在 "refs/heads/*" 参考

的 "Push" 和 "Push Merge Commit" 类别中拥有 ALLOW 权限

2) 您需要推送到 "refs/heads/BRANCH" 而不是 "refs/for/BRANCH"