Are Git forks actually Git clones?

前端 未结 10 1090
攒了一身酷
攒了一身酷 2020-11-22 04:17

I keep hearing people say they\'re forking code in Git. Git \"fork\" sounds suspiciously like Git \"clone\" plus some (meaningless) psychological willingness to forgo future

相关标签:
10条回答
  • 2020-11-22 05:02

    "Fork" in this context means "Make a copy of their code so that I can add my own modifications". There's not much else to say. Every clone is essentially a fork, and it's up to the original to decide whether to pull the changes from the fork.

    0 讨论(0)
  • 2020-11-22 05:02

    Cloning involves making a copy of the git repository to a local machine, while forking is cloning the repository into another repository. Cloning is for personal use only (although future merges may occur), but with forking you are copying and opening a new possible project path

    0 讨论(0)
  • 2020-11-22 05:07

    In simplest terms,

    When you say you are forking a repository, you are basically creating a copy of the original repository under your GitHub ID in your GitHub account.

    and

    When you say you are cloning a repository, you are creating a local copy of the original repository in your system (PC/laptop) directly without having a copy in your GitHub account.

    0 讨论(0)
  • 2020-11-22 05:08

    Apart from the fact that cloning is from server to your machine and forking is making a copy on the server itself, an important difference is that when we clone, we actually get all the branches, labels, etc.

    But when we fork, we actually only get the current files in the master branch, nothing other than that. This means we don't get the other branches, etc.

    Hence if you have to merge something back to the original repository, it is a inter-repository merge and will definitely need higher privileges.

    Fork is not a command in Git; it is just a concept which GitHub implements. Remember Git was designed to work in peer-to-peer environment without the need to synchronize stuff with any master copy. The server is just another peer, but we look at it as a master copy.

    0 讨论(0)
提交回复
热议问题