0

I am attempting to run the command git checkout -b feature origin/feature

I have a repository I've cloned down with the below lines with help from this question: (Git Clone is too slow)

$ git clone --depth=1 git@URL/path/to/repository.git
$ git fetch --unshallow

I am now trying to fetch a remote branch. git remote -v shows I am successfully connected to the remote repository:

origin git@URL/path/to/repository.git (fetch)

origin git@URL/path/to/repository.git (push)

After running git fetch origin and git branch -a I see:

* master remotes/origin/HEAD remotes/origin/master

It seems my fetch isn't getting the remote branch listed at the URL, because running the checkout command at the top returns fatal: 'origin/feature' is not a commit and a branch 'feature' cannot be created from it

How do I fetch the origin/feature branch from the URL as a tracked branch

Gino Mempin
  • 12,644
  • 19
  • 50
  • 69
  • https://stackoverflow.com/search?q=%5Bgit%5D+clone+depth+single+branch – phd Mar 16 '20 at 18:15
  • There is no need to put "[SOLVED]" or copy the answer into the question. The duplicate link will also lead readers to that same solution, and it's better if all info is in one place. If an answer in the duplicate solved your problem and you have gained enough rep, upvote it. – Gino Mempin Mar 17 '20 at 08:00

0 Answers0