My friend and I had made changes to same branch, he pushed onto it and after sometime I tried to do the same but I got. but I got error saying :
error: failed to push some refs to '<repo_name>'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first 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.
So I did a pull from the remote branch and resolved merge conflicts.
But after that when I tried to push to the remote having included changes from both me and my friend it said :
Everything up-to-date
but my changes are still not reflected in the remote repo. What am I missing here ?
Your local branch
is behind from remote branch
. So, at first pull the changes of remote then push your changes.
$ git fetch
$ git pull origin <branch-name>
$ git push origin HEAD
Or, you can use rebase
. This takes all remote commits then puts your commits at the top in git log
.
$ git pull --rebase
$ git push origin HEAD # push your local commit(s)
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