Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fork a branch and not the repository?

Tags:

How can I fork a branch instead of a complete repository? I wish to copy only the branch https://github.com/COMSYS/contiki/tree/split-buffer and not the complete repository https://github.com/jenshiller/contiki. How to fork a branch in Git? won't work in my case. I don't want to clone the branch.

like image 896
Shridhar R Kulkarni Avatar asked Jul 25 '16 09:07

Shridhar R Kulkarni


1 Answers

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

  1. clone a repository (e.g. git clone http://repository), then
  2. check out the branch you're interested in (git checkout awesome-branchname),
  3. and create a new branch based of that (git checkout -b new-even-more-awesome-branch-name)
like image 121
Marcus Müller Avatar answered Oct 08 '22 08:10

Marcus Müller