Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
507 views
in Technique[技术] by (71.8m points)

git - How to merge the Gerrit branch to another Gerrit branch

I'm using Gerrit version 2.4.2. I have a branch master and I created a new branch, called newbranch. Then I pushed some changes to the remote (Gerrit's) newbranch. After verifying in Gerrit, I merged the changes to newbranch.

No, I want to merge the newbranch to master, send updates master (merged with changes from newbranch), and delete the newbranch branch.

I tried do this:

git fetch
git checkout master
git merge newbranch
git push origin master:refs/for/master

But Gerrit gives back this message:

 ! [remote rejected] master -> refs/for/master (no new changes)

What should I do?

question from:https://stackoverflow.com/questions/12840279/how-to-merge-the-gerrit-branch-to-another-gerrit-branch

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

This situation has been reported as a bug in Gerrit. Here's a solution/workaround from Gerrit's issue tracker:

To the best of my knowledge, you have 2 options currently -

  1. Force push to refs/heads. It is just a fast-forward, so in theory everything has already been reviewed and verified. There is no point in doing so again, so just skip that process and push to refs/heads rather than refs/for.

  2. Go ahead and create a merge commit. Use 'git merge --no-ff' - this will create a merge commit even though it isn't necessary in your fast-forward situation. Then the merge commit can be uploaded, reviewed, verified, and merged like normal.

My company tends to go with option 2. I'll close this as wontfix, but if you have any suggestions on how to do this better please let us know.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...