11

I made some changes, committed them and pushed the branch to Gerrit (git push gerrit). Now my changes don't appear in Gerrit and I assume this is because I pushed the changes manually instead of using git review. When I run git review now, Im getting this error:

remote: Processing changes: refs: 1, done    
To ssh://user@gerrit-host:29418/Project
! [remote rejected] HEAD -> refs/publish/master (no new changes)
error: failed to push some refs to 'ssh://user@gerrit-host:29418/Project'

How can I tell Gerrit that my changeset needs to be reviewed?

TylerH
  • 20,799
  • 66
  • 75
  • 101
stackular
  • 1,431
  • 1
  • 19
  • 41

5 Answers5

8

you can remove that commit from remote branch or you can do this

git commit --amend

this will create a new patch

git push gerrit HEAD:refs/for/your_branch
phuclv
  • 37,963
  • 15
  • 156
  • 475
aibotnet
  • 1,326
  • 1
  • 13
  • 27
  • For me this happened when I pushed the same patch for master and then for a feature brach. The problem was that the two patches had the same change-id so the second push was rejected. After the commit --amend it worked fine. – dlp Nov 27 '17 at 10:31
5

I think the problem is that the commit already in remote branch. That is why no new changes on push. First try to remove the commit from remote branch, and then push the commit to review branch.

Community
  • 1
  • 1
laplasz
  • 3,359
  • 1
  • 29
  • 40
  • Won't this mess with Gerrit's internal database? – stackular May 22 '14 at 17:20
  • I think the problem is that on remote branch there is already a commit with that changeId you are trying to push to review branch as well. No it wont since this commit with that changeId has not reviewed yet - so no any entry for this in Gerrit database. – laplasz May 22 '14 at 17:33
0

I've found that git review will not submit a branch with no changes. It's basically saying: "since there are no changes in your commit there's no reason to submit... so I won't". Unlike your situation, this has happened to me when there was an error in the previous push.

What I've done in these cases is simply add a minor change (such as adding a blank line) so that gerrit see things as different and then it works.

Another thing you could do (depending on the process your organization uses) is to remove the Change-Id from your change log (using git commit --amend) and then run git review, thus creating a new review set, essentially staring over as far as Gerrit is concerned.

JESii
  • 4,678
  • 2
  • 39
  • 44
0

git commit --amend can't resolve several commits, only can push last one to gerrit.

Another resolution is to checkout and use cherry-pick commitid1 commitid2 commitid3, then push.

TTKatrina
  • 466
  • 5
  • 5
-2

To avoid this error

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

Just follow these steps

git commit --amend # this will create a new patch
git push gerrit HEAD:refs/for/your_branch
phuclv
  • 37,963
  • 15
  • 156
  • 475
NRN
  • 1