0
我有一个remote git repository
,我有一个remote_branch
。 我将remote_repository
克隆到我的机器上,并创建了一个local_branch
。远程和本地存储库
我现在想要push
将我的local_branch
更改为remote_branch
。 做的是,我设置了upstream flag
git branch --set-upstream-to=origin/remote_branch local_branch
然后我commit
和stage
我的变化,并尝试git push
的改变上remote_branch
。 我得到这个消息:
To [email protected]
! [rejected] remote_branch -> remote_branch (non-fast-forward)
error: failed to push some refs to '[email protected]'
hint: Updates were rejected because a pushed branch tip is behind its
remote counterpart. If you did not intend to push that branch, you may
want to specify branches to push or set the 'push.default'
configuration variable to 'simple', 'current' or 'upstream' to push
only the current branch.
然而,当我push
的通过
git push origin local_branch:remote_branch
它的工作原理改变。 我在做什么错?
我做了git checkout local_branch - >没有做伎俩,, – Stophface
再次读它,可能是你添加了你的修改(提交)到'local_branch',而其他人增加了其他提交到远程存储库?如果是这种情况,您可能需要合并或重新整理所做的更改,然后才能推送(而另一个推送则因为它实际上什么都不推送)。 'gitk --all'可以帮助可视化当前状态。 –
nope。我从'local_branch'上的'remote_branch'中取出,然后在'local_branch'中改变了一些东西,并尝试将'local_branch'推送到'remote_branch'。同样的效果。 – Stophface