• How do i clone only “master” branch [ default protected branch? ] of repo?
  • what are the advantages & disadvantages?
  • how do i remove all other branches except master of forked repo?
  • Shugzaurus@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    When you clone a repo only one branch is pulled from the remote, main by default so I don’t understand your question. Cloning and forking are two different things. Clone is basically pulling a git project to your local computer where forking will create a copy of a repo (with all the branches) to another repo).

  • senkora
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    It’s important not to conflate git and github. Cloning is a git operation. Forking is a github operation.

    I would recommend reading the excellent pro git book to understand how git works from the ground up: https://git-scm.com/book/en/v2

    I’m not aware of a similar guide to learning github but I think it will be much easier to pick up once you have a better understanding of what git provides on its own.

    Unless you need to interact with other people, you can always just clone the repo, work locally, and create your own github repo (without forking) to act as a remote and backup.