git新的远程分支同步到本地

通过

git fetch

获取新的远程分支

git branch -a

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

git checkout -b localnewbranchname origib/remotenewbranchname

不过出现了错误:

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

git reset --hard

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

git checkout -b localnewbranchname origib/remotenewbranchname

同步成功!

posted @ 2020-09-08 01:55  </Venus>  阅读(6287)  评论(0编辑  收藏  举报