Pergunta

I'm new to Gerrit and I think I'm lost not seeing something probably very obvious.

After git status I'm getting:

# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#   (use "git push" to publish your local commits)

So, I'm doing as instructed, and after git push origin HEAD:refs/for/master I'm getting:

remote: Processing changes: refs: 1, done
To ssh://URL:29418/PROJECT
 ! [remote rejected] HEAD -> refs/for/master (no new changes)

(git push and git push origin brings the very same result -- no new changes)

What am I missing? How can Gerrit claim that repo is ahead remote and that there no new changes in the same time?

BTW: I have no open changes in Gerrit, all of them are either merged or abandoned -- I'm talking about already reviewed and submitted patch/change. See my another question, which is related to this one.

Foi útil?

Solução

Till the change is not submitted from review branch to remote branch the remote branch will be behind to the local branch. But if the change/patchset does not modified it can not be pushed again to review branch. So first organize a review for your change and submit it in successful case.

Edit: refresh the remote branch info by git fetch. And I suggest that always check the remote repo status by using git remote show <remote_name> - with this you can query all the branches and you could see which one is out of date - I think the that is the situation now

Edit2: if you use git fetch then also update the local branch with git merge origin/<branch> or use git pull which is actually the two commands in one. Or If you sure that all the changes has been merged to remote branch you can reset the local branch as well - git reset --hard origin/<branch>

Edit3: when you make a direct push the local info will be updated automatically since the local branch and remote branch are synchronized. But when you push to a review branch git does not know about the life of that change further more. So till the local branch not updated with the remote branch git assumes that the local is ahead of the remote. so git pull or git fetch; git reset --hard origin/master should fix this.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top