Pushing your branch is not working because your local master
and the version on the remote have diverged. This means that, while each of these branches share a common ancestor commit, since that point each branch has added different subsequent commits. Here is a small sample diagram showing what the local and remote master
branches might look like:
remote: ... A -- B -- C
\
local: ... M -- N
Git is rejecting the push because it doesn't know how to apply the M
commit on top of the remote C
commit. The bases are different, so you just get an error telling you to pull to correct this.
Your hunch to do a git pull
is correct, but the branch state master|MERGING
means that you are already in the middle of another merge. Possibly, you pulled once already and now there are merge conflicts which need to be resolved. You can locate the files which are in conflict by doing git status
. Resolve all conflicts, and the git add
each file, followed by git commit
. After doing these steps, git push
should work.