At home I added do_next.py
and successfully pushed it to the repository. At work I created cat.py
, made commit and tried to push
which failed:
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
If I pull
, the git asks me to merge (to enter a merge comment) .
Please explain why the merge is required? I'd think that since I just added a new file, the fast-forward
would suffice and no merge is mandatory.
Besides I can't think of a sensible message for this required commit. Using: git version 2.1.4 Debian Jessie
The reason that git is asking for a merge is because git pull
is a combination of two commands, git fetch
and git merge
. Since your local branch has a commit that isn't on your remote branch and the remote branch has one that isn't on your local. You are "ahead and behind". If you don't want to do a merge, do git pull --rebase
which will set your local commit aside, update your local branch and then reapply your commit. Which since you are only adding a new file will work smoothly.