136

I noticed that a lot of GitHub accounts only have repositories which are forked from other accounts. In addition the people who do this usually don't make any contributions to the forked repositories.

I've heard of people collecting stamps and seashells, but why would anybody want to collect repositories? Personally I would only fork a repository if I wanted to make some changes to it.

Dynamic
  • 5,746
  • 9
  • 45
  • 73
Aadit M Shah
  • 1,618
  • 2
  • 11
  • 9
  • 93
    they want to ensure that they have a stable backup should the owner of the project delete his repos and disappear – ratchet freak Jun 06 '13 at 11:26
  • 9
    Simply because that's how pull requests work in GitHub (and because people are a bit fork-happy and then forget about it sometimes, or abandon their project idea and forget to get rid of the fork) – haylem Jun 06 '13 at 11:39
  • 2
    just a comment, as I understand they use as a "backup" of the code, but they forget (or not know) that updates the repository does not affect the "forks", when they should be doing right fork (for backup) and "Star" the repository to know when to do a "re-fork", in other words, they think "fork" is almost the same thing as "Star" and unaware maintains an outdated code. – Protomen May 07 '14 at 19:40
  • 1
    Because they've heard that having a Github is enough to get hired at a hot startup. – Gaius Jul 01 '14 at 15:28
  • @GuilhermeNascimento Starring doesn't help with that at all, the changes don't even show up in your feed. Did you mean watching? – alexia Jan 31 '15 at 23:15
  • @nyuszika7h I think I made it clear that I was referring to users who don't contribute to the repository, in other words don't understand the reason for a user that don't contributes to the project have a "fork" :) – Protomen Jan 31 '15 at 23:25
  • @GuilhermeNascimento That's completely irrelevant. You said people should star the repository to know when to update their fork, but starring doesn't help in that at all. – alexia Jan 31 '15 at 23:27
  • @nyuszika7h ok....... you mean I don't get updates of changes in the codes of the repository, to not be if I use fork? – Protomen Jan 31 '15 at 23:36
  • 1
    Here is post about harm of no-reason forking http://zbowling.github.io/blog/2011/11/25/github/ – gavenkoa Oct 22 '15 at 20:59

5 Answers5

111

As you mentioned in your question, people fork repositories when they want to make a change the code, because you don't have write access to the original repository (unless you've been added as a collaborator by the owner of the repository).

In the forked repository they have write access and can push changes. They may even contribute back to the original repository using pull requests.

I think there are multiple reasons why people fork repositories but don't change them:

  • they might fork a repository which looks cool, simply fork it (because it's easy (only one click)) and want to make a change later (and then probably forget it/didn't have time to do so)
  • they fork a repository to make a change and then discover that the change is unnecessary and forget to delete the own repository
  • they might fork a repository because one of the projects depends on an other repository (maybe via submodules) and they want total control over the repository used as a dependency (the owners of the original repository might decide to move from github to google code etc.)
  • they might simply forget to push the commits
MarcDefiant
  • 1,099
  • 2
  • 6
  • 8
  • 6
    When you aren't using Github, you're going the old-school route and creating a local cloned copy of the project so you can modify it. Forking on github gives you access to pull requests which are preferred by many projects. If you're on another project, you'll end up creating patches and sending those in to be reviewed. –  Jun 06 '13 at 16:45
  • It's a simple one-step process to setup a remote tracking branch. Anybody who has tried to contribute to a git repository outside of GitHub knows how tedious it can be. Plus, if the original author goes AFK, you can follow the development graph to find forks that are still actively developed. Hopefully, it'll keep GitHub from degenerating into a wasteland of dead projects the same way SourceForge did. – Evan Plaice Feb 19 '14 at 00:03
  • 1
    What if you fork a project but make no changes. Would this consider illegal? – JayC Aug 03 '17 at 19:44
  • @Jesse All Public Repositories on GitHub *should* have an Open Source License (thats their Terms of Service) and therefore its no problem at all. Especially when you make no changes. – MarcDefiant Oct 06 '17 at 09:03
82

In our line of work we tend to look for technical reasons, but in my opinion the primary reason isn't technical. If you look at GitHub Help or other GitHub tutorials, forking a repo is one of the major steps for how you "do" GitHub.

When people are learning and evaluating GitHub, just about every tutorial out there is going to tell them to fork a repo as part of that learning process. Since the primary purpose of GitHub is to contribute, a lot of people working through the standard tutorials don't realize if you just want a read-only clone you don't have to do a fork first.

Karl Bielefeldt
  • 146,727
  • 38
  • 279
  • 479
  • 53
    Along the lines of non-technical reasons: I've clicked on the 'fork' button several times hoping to see who's forked the repo, only to find that I've forked it. Ooops! Not sure if other's have done the same. – gdw2 Jun 06 '13 at 21:27
  • 69
    @gdw: Causing you to exclaim, "Oh, fork!" – Ben Jackson Jun 07 '13 at 00:47
  • 2
    I remember when I first learned about git and Github, I did some forking just because guides and tutorials seemed to propose it as *the* way to get your own copy of the code on your computer. – rmac Jun 07 '13 at 09:01
  • We use GitLab at work, so I know well the difference between clone and fork. I am also of the opinion that you don't need to fork if you don't want to issue a pull(merge for GitLab) request. – cst1992 Nov 26 '16 at 06:30
  • @Karl what if you fork a project but make no changes. Is that fine? or would that be illegal. – JayC Aug 03 '17 at 19:44
  • 4
    @Jesse, it's fine to do, but usually unnecessary in that case. A company might do it for code they depend on to make sure the original doesn't suddenly go away. If all you want to do is build from source, a clone is simpler. – Karl Bielefeldt Aug 04 '17 at 01:25
  • Why fork a repo when you can download a the .zip, create your own repo and put it in? – NoName Nov 07 '20 at 18:15
30

One possible reason: they have running code that depends on those projects and their build process involves pulling the dependencies from github. Having the fork protects them against breaking changes. For projects that don't tag versions, this is the easiest way to achieve that.

Michael Borgwardt
  • 51,037
  • 13
  • 124
  • 176
27

The entire point of Github is "social coding".

Personally, I fork repositories when:

  • I want to make a change.
  • I think the project is interesting and may want to use it in the future, but have no easier way of saving it for later on the device I'm currently using.
  • I want to use some or all of the code in that repository as a starting point for my own project.

Now I've heard of people collecting stamps and seashells, but why would anybody want to collect repositories?

Why not?

There's nothing (that I can think of) that can go wrong from forking repositories for personal pleasure. Honestly, I keep a folder of interesting projects that I see on Github and other places simply for inspirational purposes, and partly because I'm a geek. I understand that I don't have to fork the project to read the code, but I may actually want to edit that in the future.

Now start forking.

Dynamic
  • 5,746
  • 9
  • 45
  • 73
  • 11
    +1 for the "Why not?" section. – Llepwryd Jun 06 '13 at 21:02
  • My additional 2 cents on the "Why not?" section: My habit is of always doing "git push" after I've finished working on a feature; it has that Q.E.D. satisfactory feeling for me (that I don't get when writing out the remote and branch name). So whenever there's even a slightest chance that I may want to do changes to the repo, I'd prefer to fork it, instead of later having to change the default "origin" repo. – yoniLavi Jun 12 '13 at 22:31
  • 2
    I think the "Why not?" section describes how "Star" works... – TWiStErRob Mar 07 '16 at 13:08
  • 4
    Why not just give it a star to save it for later viewing? – dude Apr 03 '16 at 09:05
  • 3
    When a project is interesting I would use a star. I agree though with the rest. – Roman M. Koss Oct 24 '17 at 11:39
1

I fork a lot of repos that I might want to use the code, or if it's a project I'm interested in. When I want to come back and have another look at the code later, it's easier to find if it's listed under my repositories. I don't have to google, or bumble around trying to remember what the name was exactly or thinking "where did I see that repo about foo again?" If it's among my repos it's easier to be reminded of these things.

ChrisDR
  • 139
  • 2