Reputation: 2135
The repo I'm working on is huge, approximately 55GB. It has more number of branches & It takes lots of storage space. So I decided to clone a single branch.
I cloned the master branch using the following command.
git clone -b master --single-branch <remote-repo-url>
I verified that only the master
branch was cloned by navigating it to the project folder.
Next, I want to check out the development
branch from the remote. I tried the following command,
git checkout --track origin/development
and it gives an error fatal: 'origin/development' is not a commit and a branch 'development' cannot be created from it
How can I check out a remote branch from a single branch?
Upvotes: 0
Views: 1661
Reputation: 37712
You need to fetch the development branch first:
git fetch origin development:development
Consider using
git remote add -t development origin_development <remote_url>
to add a remote for the specific branches. Otherwise the --single-branch
parameter causes your Git to not bother fetching and updating the remaining remote-tracking names that you'd probably like to have.
Inspired by this answer
Upvotes: 4