Local checkout git remote branch

Scene: The local branch of physics is deleted by mistake, you want to re-own branch code pull down from the remote. (At this time it is taken the last time the branch code git push up)

1. re-establish a relationship with a remote repository

1
git clone git@gitlab.名称.git

2. to contact the local current branch, as master

1
git branch

3. remote detection of the desired branch

1
git checkout orgin/远程分支名

If you are not the remote branch, you need to create, and then you need to use  

1
2
git branch orgin/远程分支名
git checkout orgin/远程分支名

Merge together is

1
git checkout -b orgin/远程分支名

Well, after you do not need, do not worry you can view the local current git branch branch

4. Update the local repository

1
git fetch

The local switch to the remote branch just detectable

1
git checkout 远程分支名

6.ok, what you want the branch

1
git branch

  Well, get up with the code

Guess you like

Origin www.cnblogs.com/xing-nb/p/12163140.html