2016-11-29 106 views
3

我和我的朋友对同一个分支进行了更改,他推进了它,过了一段时间,我试图做同样的事情,但我得到了。但我得到错误说:解决合并冲突后无法推送

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. 

所以我做了一个从远程分支拉并解决合并冲突。

但在那之后,当我试图把从我和我的朋友已经远程包括改变它说:

Everything up-to-date 

,但我的变化仍然没有反映在远程回购。我在这里错过了什么?

+0

解决冲突后又添加并提交了吗? –

+0

yup!我做了男人。 @sajibkhan – blueChair

回答

3

local branch的背后,是来自remote branch。所以,首先拉动遥控器的变化然后推动你的变化。

$ git fetch 
$ git pull origin <branch-name> 
$ git push origin HEAD 

或者,您可以使用rebase。这需要所有远程提交,然后将您的提交放在top in git log

$ git pull --rebase 
$ git push origin HEAD    # push your local commit(s) 
+0

做一个拉给'已经u-date' – blueChair

+0

首先给'git fetch'命令。 –

0

你可以拉你的朋友使用

git pull origin <branchName> 

化解矛盾的分公司变更如有然后尝试

git push origin <branchName> 
1

像其他的答案说,你可能只能直接指定远程裁判,因为它看起来像你的跟踪分支不得设立推到正确的远程参考。

例如,git push origin <branchName>