Reputation: 27451
I tried all duplicated questions, but none of them worked. Please can you write correct syntax respectively for me?
I tried respectively:
git add .
git commit -m "comment"
git remote add origin https://github.com/dgknca/DogukanCavus_H5180005-MuhammetFurkanAydogdu_H5180045
git push -u origin master
push -f
works, but I don't want use it. Because it's deleting all previous commits.
This is my error:
sezginc@dgknca MINGW64 ~/desktop/DogukanCavus_H5180005-MuhammetFurkanAydogdu_H5180045-master (master)
$ git push -u origin master
To https://github.com/dgknca/DogukanCavus_H5180005-MuhammetFurkanAydogdu_H5180045
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/dgknca/DogukanCavus_H5180005-MuhammetFurkanAydogdu_H5180045'
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.
Upvotes: 1
Views: 1056
Reputation: 100
From the message it sounds like there are commits in the remote that you are missing in your local. Try comparing:
git fetch origin
git diff origin/master
That should show you what you are missing. If your current branch can be brought up to sync, you should be able to just do:
git pull origin master
Then, unless there are merge conflicts, your push should work. You may want to create another branch just to test it out to leave your local branch in its current state and avoid git fiddling if the pull doesn't go smoothly.
Upvotes: 2