Antarr Byrd
Antarr Byrd

Reputation: 26169

Can't commit changes to github

Whenever I try and to commit changes to my github repo I get this error.

To git@github.com:antarr/3skeleton.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:antarr/3skeleton.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.

If I do git pull first, it changes some of the files on my machine. Which kind of defeats the purpose.

Upvotes: 2

Views: 28387

Answers (1)

Rex Morgan
Rex Morgan

Reputation: 3029

It sounds like files have been committed and pushed to the repository on github since you last updated.

doing a git pull will pull those changes down and merge them in with your changes. You can then test everything and make sure it still works, and then do a push.

It should not overwrite the changes that you have made and are trying to commit.

Upvotes: 7

Related Questions