-4

I would like to clone the Apache Falcon project. But not the trunk/ master branch. I would like to clone the 0.6.1 branch.

For master branch I would do it with following command: git clone https://git-wip-us.apache.org/repos/asf/falcon.git falcon

But what to do for the 0.6.1 branch (https://github.com/apache/falcon/tree/0.6.1). Please help me.

MWilliams
  • 1
  • 1

2 Answers2

2

As specified in the man of git clone, you have to use the -b option.

Man page concerning the -b option :

--branch , -b Instead of pointing the newly created HEAD to the branch pointed to by the cloned repository’s HEAD, point to branch instead. In a non-bare repository, this is the branch that will be checked out.

--branch can also take tags and detaches the HEAD at that commit in the resulting repository.

It's now obvious, but you have to do the following command to clone a specific branch on a remote project:

git clone -b [BRANCH] [REMOTE].

In your case :

git clone -b "0.6.1" https://git-wip-us.apache.org/repos/asf/falcon.git falcon

Gangai Johann
  • 881
  • 12
  • 17
0

You can clone a repository, and after that you can check out a specific branch. There's no such thing as cloning a branch. When you use git clone -b, the repo will be cloned and then the specific branch will be checked out.

Balint Domokos
  • 1,021
  • 8
  • 12