Git Clone:
When we perform git clone we will only get master branch from remote repo.So to get all remote brancges you need to do either of below 2 ways:
Solution 1:(Not recommended)
Step 1:git branch -a
this will show all hidden branches
Step 2:git checkout -b DEV
Create a local branch with same name and switch to that branch.
Step 3:git pull origin DEV
It will get code from remote branch DEV.
Solution 2:(Recommended)
Step 1: git branch -a
this will show all hidden branches
(Suppose I want to checkout DEV branch)
Step 2 : git checkout remotes/origin/DEV
you will see following output
Now we can simply to work in that branch by following step:
Step 3 : git checkout DEV (here DEV is branch name)
then we can see this on git branch cmd
Note:
Solution 2 is better approach then solution 1 because, If we have same files in feature and master branch and if that file was edited in feature branch, then while pulling we will get merge conflict which results in an extra commit.
References:
https://www.quora.com/Does-the-Git-clone-command-only-copy-the-master-branch
0 Comments