views:

124

answers:

1

I'm pulling from a repository that only I have access to. As far as I know, I've only pushed to it from one repository. A couple of times, I've tried pushing to it and gotten this:

To [email protected]:tsched_dev.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:tsched_dev.git'
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.

Generally, that just means that I have to do a git pull (although all the changes should be fast-forwardable). When I do a git pull, I get conflicts. If I do a git pull --rebase, it works fine. What am I doing wrong?

+2  A: 

It means that current origin/master and current master(with your own commits) are not compatible, but that if you got the changes since the last update and put them before your own commits it leads to a non-conflicting state.

Basically that depends how you order the commits you have conflicts. With a rebase you put the origin ones before yours, with merge you put the origin ones as a whole against your master, that can make a difference.

Arkaitz Jimenez
I see. So in other words, a `git fetch` would fix the issue without using a `git pull --rebase`?
Jason Baker
Arkaitz Jimenez