git 切换到本地不存在但远端存在的分支

使用背景

比如有人往remote推送了一个新的分支,自己本地没有,但想同步到本地

git switch

  • 首先 git branch -r ,找到你需要的那个分支名称
  •  origin/HEAD -> origin/master
    origin/newBranch  
    
  • git switch newBranch 本地没有这个新分支,git switch 命令会自动创建并跟踪

参考

https://stackoverflow.com/questions/9537392/git-fetch-remote-branch

posted @ 2022-01-28 11:07  略略略——  阅读(508)  评论(0编辑  收藏  举报