[英]git pull from wrong remote branch
我的起源有fixes
和fixes_v3
分支。 我的客戶剛fixes
。 我做了一個git pull git+ssh:/.../mygitrepo
,突然在我的客戶端上我fixes
分支中的所有fixes_v3
代碼。 為什么這發生了? 現在我嘗試git pull ... mygitrepo fixes
它只是告訴我它是最新的。
git remote show origin
給出了這個:
HEAD branch: fixes
Local refs configured for 'git push':
fixes pushes to fixes (fast-forwardable)
master pushes to master (up to date)
顯然你的分支機構正在追蹤虛假的遙控器。 做一個git remote show origin
來查看哪個分支遠程分支fixes
合並。 它可能會說類似的東西
fixes merges with remote fixes_v3
撤消上次合並后,相應地調整此值。
快速修復?
撤消所有本地提交。 例如
選擇分支進行撤消
git branch fixes
刪除本地提交
git reset --hard origin/fixes
主題分支怎么搞砸了?
就我而言,我沒有命名目的地就拉了一下:
git pull origin cifs_support
由於沒有本地cifs_support
分支,因此來自origin/cifs_support
的提交已添加到master
。
你安全嗎?
不。使用接受答案中的建議檢查您的配置:使用git remote show origin
查看受git pull
和git push
影響的分支。 如果分支跟蹤錯誤,請盡快修復。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.