I decided to try to mess around with Git today and try to learn how its branching system works. Bad idea. I somehow have gotten myself in a state where I have committed a change on a branch, and when I do “git push” I get:
To git@github.com:LAW/Repo.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:LAW/Repo.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.
I’ve seen this a few times, and I have done “git pull” to resolve, though I’m not sure why or how that resolves things. The problem is, it isn’t working now. I do “git pull” and get:
"Already up-to-date."
And the problem persists. So my question is…now what? I can’t push from the branch, so it is essentially dead, but the internet has no better advice than “git pull” to fix this. Needless to say this is VERY frustrating!
EDIT A commenter requested the output of “git branch -a”. The branch in question is “PersonalSite”
* PersonalSite
master
remotes/origin/HEAD -> origin/master
remotes/origin/PersonalSite
remotes/origin/master
You should be able to simply update the master branch:
To verify: