I'm still git newbie. I modified some source files and committed. Then, I did git push
. But, I got this error.
To /foo/bar/ ! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '/foo/bar/' To prevent you from
losing history, non-fast-forward updates were rejected Merge the
remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
This reject seems that I didn't git pull
before push
. So, I did git pull
. Okay, there were two modified files by others.
Then, I was able to git push
successfully.
Question: In this case, I'm seeing one more log like following with my original commit message:
commit 59e04ce13b8afa...
Merge: 64240ba 76008a5
Author: Jone Doe <[email protected]>
Date: Fri Mar 15 11:08:55 2013 -0700
Merge branch 'master' of /foo/bar/
And this is my original commit message.
commit 64240bafb07705c...
Author: Jone Doe <[email protected]>
Date: Fri Mar 15 11:06:18 2013 -0700
Fixed bugs and updated!
I'd like to understand why "merge branch master of location" is added.
When you did a git-pull
, modifications from the remote branch were merged into your local branch. The automatically generated commit signifies that.
Merging could have resulted in conflicts, which would then need to be resolved manually. In your particular case, this did not happen and git could take care of everything.