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?
相关问题
- How to add working directory to deployment in GitH
- Upload file > 25 MB on Github
- Can I input Git command in Android Studio IDE?
- Source tree not able to push
- Git lost local commited files after git checkout
相关文章
- java开发bug问题:GitHub授权登录无法获取授权账号信息?
- Is there a Github markdown language identifier for
- “no implicit conversion of Integer into String” er
- GitHub:Enterprise post-receive hook
- git commit directory
- Tag multiple branches in git?
- travis-ci setup releases with --github-token
- git commit gives error: empty commit set passed
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:
Fetch the full upstream repository. (Right now, you only have a copy of its master branch.)
Make your file system copy the branch you want and give it any name:
Publish your repo using the GitHub desktop application.
Delete the master branch on your shell and make a new master branch:
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).
Switch to the branch you need in source repo Click "Fork". You'll get forked master and the branch you're in. I don't know how it works with more branches, but for my needs worked pretty well.
Cloning means that you create a copy of the whole repository in your account including all branches and tags. However you are free to switch and track branches however you like.
A fast, alternative approach is to create your own new repo.
Go to https://github.com/new and make a new repo. Do not initialize with README.
Scroll down to get your
git remote
Then:
You will have a new repo with the original repo's code and a branch that can be made into a pull request.
I'm using bitbucket but I'm sure this would work for GitHub as well.
Your new repository will have the full history of the one branch only (not all branches like forking will have).
Yes, you can clone the single branch. For example, you have a branch named release1.0. If you would like to clone this branch into your pc then use the following line of code: