I am using gerrit
for a project, I have a feature branch locally that has two commits (1) (2) diverged from remote develop branch as show in the image
Before I could push my changes to remote develop, I pulled from remote, merged the changes as shown in the node (m). Then, I tried to push to remote, I got an error message saying there are conflicts between (1) (2) and (3) (4).
I don't understand why this happened, I thought git push
only pushes the merged one (m) to the remote. So to solve this, I have to reset the merge, rebase to the develop, then push, but I feel there should be a better way to deal with this.
EDITS:
I already solved the issue by rebase, which is exactly @Marcelo suggested here, cannot go back to get the exact error message, but what happened is when I pull there was conflicts, I fixed the conflicts and merged, and then I type git status
it says i am 1 commit ahead of remote, so i did git push origin HEAD:refs/for/developer
, and Gerrit won't let me push by saying there is conflicts for commit (1) and (2), not commit (m) as shown in my image... I don't understand this part as i thought push
only pushes the commits that are ahead of remote, why the remote says there are conflicts for commit (1) and (2), i suspect that is because of Gerrit's special settings.