通过

git fetch

获取新的远程分支

git branch -a

可以查看到本地分支和远程分支
然后通过以下命令创建新的分支来保存远程分支

git checkout -b localnewbranchname origib/remotenewbranchname

不过出现了错误:
git新的远程分支同步到本地
经过研究,是因为本地代码做了改动,和远程代码发生冲突,
参考http://www.skcircle.com/?id=400
自己的修改几乎没有,所以决定放弃本地代码修改

git reset --hard

重置代码到origin/master状态
然后重新执行

git checkout -b localnewbranchname origib/remotenewbranchname

同步成功!

相关文章:

  • 2021-06-23
  • 2021-08-14
  • 2022-02-07
  • 2022-01-10
  • 2022-02-07
  • 2022-02-07
猜你喜欢
  • 2022-02-07
  • 2022-02-08
  • 2021-07-15
  • 2022-12-23
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案