簡體   English   中英

git從錯誤的遠程分支拉出來

[英]git pull from wrong remote branch

我的起源有fixesfixes_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 pullgit push影響的分支。 如果分支跟蹤錯誤,請盡快修復。

暫無
暫無

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

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