Search code examples
gitdownloadbranchclone

git get a copy of a branch


how do I get a copy of a branch from a remote git server? I have tried the following options

git clone url
git clone url branchName  

it looks they get the master copy.


Solution

  • You can use the the --branch or -b option on clone:

    git clone -b <name> url
    

    See man git clone for further details.