Git / gerrit, push remote rejected no changes made

If you are trying to update a set of reviews, each with their own change-id that you want to maintain (say, after a rebase where you swap the order of two commits), you might get rejected if some of the commits in the pile remain unchanged. You should force a new hash to be generated by rewording the commits, or something similar.


Please refer to the official documentation on this issue here:

https://gerrit-review.googlesource.com/Documentation/error-no-new-changes.html

I had the same issue, my issue was that I pushed the change, then abandoned that merge, then I made a few tweaks, wrongfully amended my commit and pushed again. That is where I got the error.

My fix:

  1. If you just want to quickly get around this issue, do git commit --amend, remove the existing change-Id, assuming you have the git hooks set up, you can finish the commit and a new change-Id should be assigned to you.
  2. Go into gerrit and search for your existing change-Id, figure out what is going on, and fix accordingly. (recommended)

This issue is due to the actions I'd performed previously. I was trying to push a new change, on top of a change which was still up for review, who's parent also was up for review.

 Trunk ------ Parent A ----- Parent B ----- New change
(merged)     (unmerged)     (unmerged)

I had used cherry-pick to obtain these two changes locally (Parent A and Parent B), and then a third cherry-pick to get my change from a local branch before attempting to push. That is what caused the issue, because my personal change was essentially trying to re-write history.

The correct process would be to only pull Parent B when at trunk. This automatically pulls up any commits between trunk and it (in this case just Parent A). Then cherry-pick my new change on top of that and push will work fine.

Tags:

Git

Gerrit