Is there a way to fork from a specific branch on GitHub? … For example, moodle has many branches (1.9, 2.0 … and so on). Can a clone be performed of just branch 1.9 and not the master branch always? Is it possible to clone a specific branch onto my PC?
I don’t know a native way yet, but you can do it following this recipe:
git
commands are not available from the default PowerShell unless you configure that manually.)Set the source repository as upstream:
git remote add upstream https://github.com/{user}/{source-repo}.git
Fetch the full upstream repository. (Right now, you only have a copy of its master branch.)
git fetch upstream
Make your file system copy the branch you want and give it any name:
git checkout upstream/{branch-in-question}
git checkout -b temporary
Publish your repo using the GitHub desktop application.
Delete the master branch on your shell and make a new master branch:
git branch -d master
git branch master
git checkout master
git -d temporary
Once more, publish your repo using the GitHub desktop application.
This should be what you were looking for. Perhaps GitHub will provide a more convenient way to do this in future (e.g., clicking “Fork” from a project’s branch results in exactly this behaviour).