How to clone a specific branch in git bitbucket

I want to clone a specific branch. I do not want to load the master branch.

How do I clone an entire project and then switch to the validations branch?

+6
source share
4 answers

You can clone one branch (without unintentionally cloning the entire project) with the following:

 git clone <url> --branch <branch> --single-branch [<folder>] 

Alternatively (trying to solve your new question here ...), you can clone the whole project

 git clone <url> 

Change the directories in the folder and create a new wizard branch using

 git checkout -b validations 
+13
source

Use git clone as follows:

 git clone -b specific/Branch --single-branch git://sub.domain.com/repo.git 

And, a useful link

https://git-scm.com/docs/git-clone/1.7.10

Also, if you get an error message with "-single-branch", then removing it -b will work for you.

+2
source

To pull out a separate branch, you need to follow two simple steps.

  • Create a new branch
  • Pull the desired branch

Try using the following commands:

git checkout -b <new-branch-name>

git pull origin <branch-to-pull>

Now you will have all the content in the <new-branch-name>

+1
source
 git clone -b branchName remote_repo_url 

For example git clone -b develop https://github.com/SundeepK/CompactCalendarView.git

+1
source

Source: https://habr.com/ru/post/986343/


All Articles