Made changes to a commit, performed commit amend. Do a push and I get the error:
! [remote rejected] master -> refs/for/master (no changes made)
Checked the change ID in the commit message and its still a valid commit.
I’ve tried changing a file, checking it shows up as an alteration and then added to staging area and done another commit amend. Try the push again and getting the same issue. No idea on this one.
Edit: This is pushing to gerrit, not git directly.
I’m running:
git push origin master:refs/for/master
And the result of getting the details of origin are (with company details edited out):
$ git remote show origin
* remote origin
Fetch URL: ssh://lytee@gerrit.mycompany.net:29418/myrepo
Push URL: ssh://lytee@gerrit.mycompany.net:29418/myrepo
HEAD branch: master
Remote branch:
master tracked
Local branch configured for 'git pull':
master rebases onto remote master
Local ref configured for 'git push':
master pushes to master (up to date)
This issue is due to the actions I’d performed previously. I was trying to
pusha new change, on top of a change which was still up for review, who’s parent also was up for review.I had used
cherry-pickto obtain these two changes locally (Parent A and Parent B), and then a thirdcherry-pickto get my change from a local branch before attempting topush. That is what caused the issue, because my personal change was essentially trying to re-write history.The correct process would be to only
pullParent B when at trunk. This automatically pulls up any commits between trunk and it (in this case just Parent A). Thencherry-pickmy new change on top of that andpushwill work fine.