Blog Archive

Wednesday, November 22, 2017

How to clone a specific Git branch?



git checkout -b <branch-name> <origin/branch_name>
To be specific, you need know your desired branch name, which can be figured out by issuing:  
git branch -a
For example: 
 git branch -a
* master
  origin/HEAD
  origin/enum-account-number
  origin/master
  origin/rel_table_play
  origin/sugarfield_customer_number_show_c
So to create a new branch based on my enum-account-number branch I do:
git checkout -b enum-account-number origin/enum-account-number
After you hit return the following happens:
Branch enum-account-number set up to track remote branch refs/remotes/origin/enum-account-number.
Switched to a new branch "enum-account-number


Reference:

How to clone a specific Git branch? - Stack Overflow:



No comments:

Post a Comment