To github.com:Yee-Q/yeexang-community.git
! [rejected] dev -> dev (non-fast-forward)
error: failed to push some refs to '[email protected]:Yee-Q/yeexang-community.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
錯誤提示如上,本地專案向遠程推送時,提示遠程 non-fast-forward,即時本地比遠程領先,推送前必須先合并,Git 也給出提示了,要我們先 git pull
There is no tracking information for the current branch
這是因為沒有指定本地分支與遠程分支的關聯,可以使用
git pull origin dev
如果希望一勞永逸,可以使用
git branch --set-upstream-to=origin/dev
fatal: refusing to merge unrelated histories
執行 pull 操作時,如果出現這個錯誤,是由于本地倉庫和遠程倉庫有不同的開始點,也就是兩個倉庫沒有共同的 commit 點而出現的無法提交,這里我們需要用到 --allow-unrelated-histories,也就是我們的 pull 命令改為下面這樣的:
git pull --allow-unrelated-histories
fix conflicts and then commit the result
pull 操作會自動進行合并,但產生了沖突,一般會有提示是哪個檔案產生沖突,找到對應的檔案進行修改,再提交一次就行了
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/157392.html
標籤:其他
