您好,我正在開發一個作業系統專案,并試圖檢查其他人的分支。
語境:
- 我已經分叉了 repo 并將其設定為我的來源。
- 原始 repo 設定為我的上游。
- 有人已經制定了一份 pr 草案,我想對其進行調整(他們也意識到了這一點)。
- 我想查看他的草稿公關分支
- 他的pr草案是從他的分叉倉庫到主倉庫的
- 我在本地主
我試過的:
git checkout -b [otherDevelopersUsername]:[otherDevelopersBranch] upstream/[otherDevelopersUsername]:[otherDevelopersBranch]
但我收到以下錯誤:
fatal: 'upstream/[otherDevelopersUsername]:[otherDevelopersBranch]' is not a commit and a branch '[otherDevelopersUsername]:[otherDevelopersBranch]' cannot be created from it
我究竟做錯了什么?謝謝您的幫助。
編輯:
git remote -vv
輸出
來源 https://github.com/[myUsernam]/ [repoName ](獲取)
origin https://github.com/[myUsername]/ [ repoName](推送)
上游 https://github.com/[OrgName]/ [repoName ](獲取)
上游 https://github.com/[OrgName]/ [ repoName](推送)
uj5u.com熱心網友回復:
如果我正確理解了這個問題,答案可能是顯而易見的。
你有兩個遙控器:
origin這是你的 repo 分支。upstream這是原始回購。
其他人做了一個 PR,你說:
他的pr草案是從他的分叉倉庫到主倉庫的
“他的分叉回購”一詞意味著他在他的分支所在的地方有自己的分叉。在這種情況下,您需要第三個遙控器指向他的分叉存盤庫,以便從中提取。
uj5u.com熱心網友回復:
如果分支存在于另一個分叉的 repo 上,您可以通過以下方式獲取它。將分叉的 repo 添加為另一個遠程并從中結帳:
git remote add forked https://github.com/something/something.git
git fetch forked
git checkout -b otherDevelopersBranch forked/otherDevelopersBranch
git fetch從遠程獲取任何更新和新提交。checkout命令將創建一個本地分支追蹤遠程分支otherDevelopersBranch遠程forked
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/341231.html
