Reputation: 936
bbb
bbb
push changes to the remote repo abc
branch
used this command:
git push origin bbb:abc
It works fine.
then going to push changes to the remote repo master branch used this command:
git push origin bbb:master
Then the below error message comes:
! [rejected] bbb -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/sw7x/testing4.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Can anybody explain why this happens?
Upvotes: 1
Views: 4714
Reputation: 48123
As git itself said:
hint: (e.g. 'git pull ...') before pushing again.
first pull
(or even fetch
) from master, do the required changes and finally push
. If you're a mean person and do NOT care about other people changes, you can use push -f
to force the push.
The reason you get this error is that your local version is different from the version resides in github repo and you should reconcile those two somehow to be able to push
your code.
Upvotes: 5