2013-10-15 86 views
0

我有分支名爲X我想要推送到遠程主分支。Git推混淆

但是,當我執行:

git fetch remote_name 
git checkout -B branchX remote_name/master 
... 
Add a commit 
... 
git push remote_name master 

我得到一個錯誤說:

Updates were rejected because a pushed branch tip is behind its remote 
counterpart. Check out this branch and integrate the remote changes... 

如果我檢查我branchX唯一承諾值,那麼我可以看到,收銀臺是正確的,有有被添加了一個新的提交,所以我確定我是remote_name master的頭。 在此期間遠程主服務器尚未收到任何新的提交。

我通常在其他地方使用這個程序,區別在這裏只是分支名稱不一樣。 我在做什麼錯?

+0

'git status'是什麼意思? – Tim

+0

如果你的本地修改是在'branchX'中,你爲什麼推分支'master'? – Jokester

回答

3

您正試圖把你的本地回購的master到遠程的master。您的推送命令有效地擴展到:

git push remote_name refs/heads/master:refs/heads/remote_name/master 

顯然,這不是您要做的。你需要明確指定哪些分支去哪裏:

git push remote_name branchX:master 
+0

謝謝。說得通。無法理解文檔:)。 –

1

嘗試:

git push remote_name branchX:master