git本地检出远程分支
场景:本地分支被误物理删除,想要重新将自己的分支代码从远程拉取下来。(此时取的是最后一次git push上去的分支代码)
1.与远程仓库重新建立关系
| 1 | git clone git@gitlab.名称.git | 
2.联系后,查看本地当前分支,为master
| 1 | git branch | 
3.检出想要的远程分支
| 1 | git checkout orgin/远程分支名 | 
如果你是远程没有该分支,就需要创建了,这时就需要使用
| 1 2 | git branch orgin/远程分支名git checkout orgin/远程分支名 | 
合并一起就是
| 1 | git checkout -b orgin/远程分支名 | 
好了,之后的就不需要了,不放心你可以git branch查看下本地当前的分支
4.更新本地仓库
| 1 | git fetch | 
5.本地切换到刚刚检出的远程分支
| 1 | git checkout 远程分支名 | 
6.ok,就是你想要的分支了
| 1 | git branch | 
好了,代码用起来吧
 
                    
                     
                    
                 
                    
                
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号