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