4

What's the difference between creating a mirror and a fork. Both are copies of a repo, but is one a shallow copy (mirror) and one a deep copy (fork)? Just trying to get a better understanding for migrating a repo.

sam.hay
  • 77
  • 1
  • 6
  • 2
    *Git* doesn't have "forks": those are concepts found on most Git hosting sites. They're effectively server-side clones with added features. The added features are good for you (because, WOO, **FEATURES**, aren't features always good? don't you want your car to also be a submarine and airplane and tunnel-boring flamethrower?) and also good for them because they do tricky things that save them disk space. – torek Aug 12 '22 at 00:55
  • 2
    The unfortunate side effects of this now include: (1) people call clones "forks", making it hard to communicate clearly; and (2) people think that all forking systems (github, gitlab, bitbucket) are the same (they're not). They mostly have very similar *goals* though, so use whatever works well for you... – torek Aug 12 '22 at 00:59

1 Answers1

-1
  • A fork is a copy of a repository. Forking a repository allows you to freely experiment with changes without affecting the original project. Usually a fork knows about its source repository, usually called upstream. This fact allows for sending pull requests (changes between upstream repo and the fork) back to upstream repo.
  • A mirror allows to maintain a copy of repository without forking it
Eugene Ryzhikov
  • 17,131
  • 3
  • 38
  • 60
  • 3
    Sounds like github jargon. In git terms, all clones are the same.... a person can clone a project, a second person can clone from the first person, a third can clone from the second... and they can all relate to the original repo.... to git, all repos are the same in terms of how to syncup, pull, push stuff – eftshift0 Aug 11 '22 at 20:44
  • so what I'm understanding is that clone, clone --mirror, and fork are all the same. I think I've found that you can only fork to another github repo, while you can mirror to another platform (code commit, bitbucket, etc.) – sam.hay Aug 11 '22 at 21:57
  • 2
    @sam.hay Have you by any chance read the [docs](https://git-scm.com/docs/git-clone#Documentation/git-clone.txt---mirror)? – 8bittree Aug 11 '22 at 23:39