首页 > 其他 > 详细

Git checkout别人的分支error

时间:2021-04-02 17:17:09      阅读:22      评论:0      收藏:0      [点我收藏+]

在dev分支执行切换分支命令,失败。之前没有切到过这个分支。

原因是,别人在远端新建的分支,需要fetch拉取同步远端所有的分支才可以。(虽然我本地dev分支有fetch->merge,但这两个操作应该不一样。 // 如有理解错误,请评论指出,谢谢!)

PS E:\code\develop\project> git checkout other-branchB
error: pathspec ‘other-branchB‘ did not match any file(s) known to git

解决办法:

1)在dev分支:git branch -a  //查看所有分支列表,看到打印出

other-branchA // 以前切换成功的分支,也是别人的分支
* dev   // 当前分支
remotes/origin/other-branchB// 远端分支

2)git fetch // 拉取所有远端分支,看到打印出

 * [new branch]      other-branchB         -> origin/other-branchB

3)  git checkout other-branchB //开始切换分支,看到下面的就是切换成功了

Switched to a new branch ‘other-branchB‘
Branch ‘other-branchB‘ set up to track remote branch ‘other-branchB‘ from ‘origin‘.

Git checkout别人的分支error

原文:https://www.cnblogs.com/xxiaonian/p/14610843.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!