簡體   English   中英

如何解決git錯誤:重命名遠程分支時“更新被拒絕,因為當前分支的提示落后”

[英]How to resolve git error: “Updates were rejected because the tip of your current branch is behind” when renaming a remote branch

我已經讀過這個問題,但我的問題是不同的。

我正在嘗試將名為feature/fix_unofficial_locales的遠程分支重命名為features/fix-unofficial-locales

git checkout feature/fix_unofficial_locales
git pull
git branch -m features/fix-unofficial-locales
git push origin --delete feature/fix_unofficial_locales
git push origin -u features/fix-unofficial-locales

現在出現錯誤消息。 在此處輸入圖片說明

feature/fix_unofficial_locales以前從未在我的本地機器中出現過,所以我是第一次檢查它。 我沒有進行任何提交,所以我不明白為什么我當前分支的提示在后面......

錯誤消息 feature/fix-unofficial-locales -> feature/fix-unofficial-locales (non-fast-forward) 僅當您使用現有提交的遠程分支的名稱重命名分支時才有意義。

嘗試:

git fetch
git branch -u origin/features/fix-unofficial-locales features/fix-unofficial-locales
git pull
# resolve conflicts
git push

您可以查看此答案: 如何在 Bitbucket 上重命名分支后推送更改?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM