1

I am on no branch and the only person who push currently to the stream, why when I do

git push

I get:

! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/dsak.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

After perform git pull the git push works just fine.

0x90
  • 39,472
  • 36
  • 165
  • 245

2 Answers2

2

After perform git pull the git push works just fine.

Apparently there were some commits in the remote repo that did not exist in your local repo. This could occur if you used git reset at some point, amended or otherwise changed existing commits (although git pull should've given you a warning if this was the case), or if you pushed to the remote from another repo (such as one on another computer).

mipadi
  • 398,885
  • 90
  • 523
  • 479
  • no there wasn't commit on the remote that doesn't exist locally, but vice versa is correct I added files aren't in the remote to the local – 0x90 Feb 20 '13 at 06:40
  • @0x90: You wouldn't get that error if you only added commits to your local repo that were a direct descendant of the contents of the master branch on the remote. There were at least some commits in your local repo that were different from ones on the remote. – mipadi Feb 20 '13 at 19:05
1

no there wasn't commit on the remote that doesn't exist locally, but vice versa is correct I added files aren't in the remote to the local

You might have the same commits, but the SHA1 must have differed somehow.
That can happen if you did a rebase of master at any point (including a rebase --interactive, just to reorder or drop some commits within master itself).

the only other case when that error message can pop up while having the same commits (and even the same SHA1) is when you have a conflicting tag (but I don't think it applies here).

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250