viral_mutant
viral_mutant

Reputation: 1003

Gerrit rebase local branch with upstream master

I need some help with pushing the community rebased branch to our gerrit.

We have a project which is forked out from a community project. Earlier we didn't use gerrit so rebase and push was easy. But with gerrit now in picture, things are confusing for me.

I need to rebase our forked out release branch with upstream release branch.

Here is what I did till now

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

After this, there were some conflicts which I resolved. Then added an empty commit to mark rebase

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

Now the fun began :)

When I did git review, it gave error that commiter mail id doesn't match my id. So I gave myself permission to 'Forge Committer' and 'Forge Author'

Now it shows all the commits but finally complains:

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:

Upvotes: 2

Views: 6193

Answers (1)

You can, of course, squash all community commits in just one big commit and put the Change-Id on it but this is not the best thing to do. I think that, in this case, you don't want to review all community commits, right? This task doen't make sense. So, the best approach is to push straight to branch bypassing Gerrit. How to do this?

1) You need to have ALLOW permission in "Push" and "Push Merge Commit" categories of the "refs/heads/*" reference

2) You need to push to "refs/heads/BRANCH" instead of "refs/for/BRANCH"

Upvotes: 2

Related Questions