Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to push after resolving merge conflicts

Tags:

git

github

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 ?

like image 373
blueChair Avatar asked Nov 29 '16 14:11

blueChair


1 Answers

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)
like image 79
Sajib Khan Avatar answered Nov 15 '22 00:11

Sajib Khan