Question:
I’m getting following error, whn trying first Github push:
1 2 3 4 5 6 |
[rejected] master -> master (non-fast forward) error: failed to push some refs to 'git@github.com:me/me.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before pushing again. See the 'non-fast forward' section of 'git push --help' for details. |
how can I fix this and merge remote changes?
Answer:
See the ‘non-fast forward’ section of ‘git push –help‘ for details.
You can perform “git pull”, resolve potential conflicts, and “git push” the result. A “git pull” will create a merge commit C between commits A and B.
Alternatively, you can rebase your change between X and B on top of A, with “git pull –rebase”, and push the result back. The rebase will create a new commit D that builds the change between X and B on top of A.