How to fork a branch and not the repository?
In github (and in git's mental framework) you clone and fork repositories.
There's no way to fork a branch; that doesn't make sense. Just fork the project, and work off the branch you're interested in. You don't lose anything by doing so.
"Working off a branch" usually means you
- clone a repository (e.g.
git clone http://repository
), then - check out the branch you're interested in (
git checkout awesome-branchname
), - and create a new branch based of that (
git checkout -b new-even-more-awesome-branch-name
)
I usually go for the option described in How do I clone a single branch in Git?
git clone <url> --branch <branch> --single-branch [<folder>]
It is quick, clean, and if I want to create a new repo out of the branch it's also very easy to do.