I'm trying to push my changes to a repo on my NAS. It's failing in a way I don't understand.
The documentation states that by default push
works only with fast-forward updates. Fair enough. So I do a git pull
(my remote is called rubix
):
D:\RoboCup\Dev\TinMan>git pull rubix master From ssh://rubix/volume1/git/TinMan * branch master -> FETCH_HEAD Already up-to-date.
All looks well. Let's try pushing...
D:\RoboCup\Dev\TinMan>git push rubix master To ssh://dnoakes@rubix/volume1/git/TinMan ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'ssh://dnoakes@rubix/volume1/git/TinMan' 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.
I've read through the documentation on git push
but at this point I can't understand why I'm seeing this problem.
Here is some other contextual info:
D:\RoboCup\Dev\TinMan>git --version git version 1.7.0.2.msysgit.0 D:\RoboCup\Dev\TinMan>git branch * (no branch) master
That last line looks suspect. How can I not be on any branch? Note too that I have some untracked files and modifieds (unstaged) changes too.
Any help would be greatly appreciated. Thanks.
Here's one way to get synced up.
First, Commit any changes, then use git log
to note any commits you wanted to push.
Next reset your master to match the remote like this:
git checkout master
git reset --hard remotes/rubix/master
Finally, cherry pick the commits you wanted to keep
Example:
git cherry-pick 111aaa111
git cherry-pick 123abc123
Now pushing should work.
git push rubix master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With