Clone from a branch other than master

前端 未结 4 668
不思量自难忘°
不思量自难忘° 2021-01-30 03:20

I am trying to pull from a repository in Github. But I don\'t want to clone the master branch. I want to clone some other branch. When I try git clone ,

4条回答
  •  一生所求
    2021-01-30 03:55

    git clone 
    

    clones and creates remote-tracking branches for each branch. If you want to see available branches (after cloning), you type

    git branch -l
    

    To switch to a particular branch after cloning you do:

    git checkout 
    

    where branchname is the name of the branch :)

    If you want to clone and checkout a specific branch you do

    git clone -b  
    

    The other commands you mention are for "updating" your current working copy. git pull gets all changes from the remote repository and merges them while git fetchonly gets them without merging.

提交回复
热议问题