git - 如何使用 git bash 切换到另一个用户的分支
问题描述
我正在开发一个 GitHub 项目,我正在尝试从 master 切换到另一个用户的分支。他们的分支领先于 master 并且有多个更改。无论我尝试什么,我都无法切换到他们的分支并获得他们的更改。
我尝试了许多 gitbash 命令,包括 checkout、pull、clone、fetch。
git clone link
git checkout branchName
git fetch branchName
git fetch
我希望“git checkout branchName”切换到其他用户的分支,但它只是切换到具有相同名称的全新本地分支。“git fetch branchName”只是返回一个错误。
我已经使用 git 多年了,我觉得自己像个白痴,我无法弄清楚这一点。我也无法在网上的任何地方找到解决方案。
解决方案
git checkout <other_users_remote>/branchName
或git checkout -b branchName <other_users_remote>/branchName
创建一个跟踪分支
您是否添加了其他人的遥控器?git remote -v
推荐阅读
- python - 如何通过键绑定或宏退出 Python 程序或循环?键盘中断不起作用
- php - Wocomerce 在将其他特定物品添加到购物车时删除特定购物车物品
- python - 使用一个字典与多个字典来存储程序配置
- c# - C# WPF / WinForms - 在 WPF / WinForm 中调用异步方法永远不会完成
- git - Atlassian Bitbucket Sourcetree Git Credential Manager 提示
- qt - 带有信号的 Qt 库设计
- javascript - 反应私有路由不渲染登录组件
- python-3.x - 无法导入 cross_validation
- android - firebase 身份验证和 json
- c# - ThreadPool.QueueUserWorkItem preferLocal 有什么用?