WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: using git to get a specific branch...some info  (Read 1429 times)

aus9

  • Guest
using git to get a specific branch...some info
« on: July 29, 2018, 09:15:41 AM »
Hi

my skills with git have been limited to either using a script to download the zip from various git repos or

Code: [Select]
git clone <url>
recently I needed to download a specific branch of a git  so I looked for a simple way
my ref was
https://stackoverflow.com/questions/1911109/how-to-clone-a-specific-git-branch

first from that link I quote
Quote
Here is a really simple way to do it
Clone the repository....git clone <repository_url>
List all branches...........git branch -a
Checkout the branch that you want.....git checkout <name_of_branch>

This did not work for me. It was not re-testing that I found the method should IMHO have read
Code: [Select]
git clone <repository_url>
cd <download-name>
git branch -a
git checkout <name_of_branch>

but highest vote works better
Quote
git clone -b <branch> <remote_repo>

hope that helps other newbie git users