我已經完成了以下步驟:
>git checkout remote-branch-test
>git pull
>git checkout remote-branch
>git pull
>git merge remote-branch-test
Automatic merge failed; fix conflicts and then commit the result.
解決了沖突
>git add .
>git commit
>git push origin remote-branch
**! [remote rejected] remote-branch -> remote-branch (you are not allowed to upload merges)
error: failed to push some refs to ....
當我在遠程服務器上執行 git status 時
>git status
On branch remote-branch
Your branch is ahead of 'origin/remote-branch' by 37 commits.
(use "git push" to publish your local commits)
我無法將更改推送到遠程
我在這里缺少什么?
uj5u.com熱心網友回復:
這里有幾件事需要注意。 博士指出最重要的:
[remote rejected] ... you are not allowed to upload merges
這告訴我們你的“遠程”——你發送提交的另一個 Git——只是禁止所有合并提交,句號。
然而,那個特定的錯誤訊息不是來自 Git 或 GitHub,而是來自Gerrit。例如,請參閱Gerrit:遠程拒絕(不允許上傳合并),即使我允許“推送合并提交”。這意味著您沒有使用 GitHub 進行推送。因此github標簽可能不合適。而且,由于 Gerrit 在 Git 上添加了自己的一層,混帳標簽也可能不合適。我加了格里特 在這里,但您應該確保這些是正確的標簽并洗掉任何不合適的標簽。
最后,合并添加許多提交是正常的:合并提交有兩個父項,因此向某個分支B添加一個合并提交通常會向B添加 N 1 個提交,其中N是從提交中可到達的提交數在合并之前合并但不是來自B本身。因此,您的合并合并了現有的 36 個提交,加上合并本身,總共 37 個提交。
uj5u.com熱心網友回復:
通過以下步驟解決問題:
混帳
git checkout 起源/遠程分支
git merge --squash origin/remote-branch-test
提交
git push origin HEAD:refs/for/remote-branch
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/313228.html
上一篇:如何“禁用或修改稀疏規則”?
