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.

9
  • 93
    they want to ensure that they have a stable backup should the owner of the project delete his repos and disappear Jun 6, 2013 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 6, 2013 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. May 7, 2014 at 19:40
  • 1
    Because they've heard that having a Github is enough to get hired at a hot startup.
    – Gaius
    Jul 1, 2014 at 15:28
  • 1
    Here is post about harm of no-reason forking zbowling.github.io/blog/2011/11/25/github
    – gavenkoa
    Oct 22, 2015 at 20:59

5 Answers 5

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.

7
  • 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 6, 2013 at 21:27
  • 69
    @gdw: Causing you to exclaim, "Oh, fork!" Jun 7, 2013 at 0: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 7, 2013 at 9: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, 2016 at 6:30
  • 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. Aug 4, 2017 at 1:25
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
4
  • 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.
    – user7433
    Jun 6, 2013 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. Feb 19, 2014 at 0:03
  • 1
    What if you fork a project but make no changes. Would this consider illegal?
    – JayC
    Aug 3, 2017 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. Oct 6, 2017 at 9:03
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.

1
  • 5
    They can fix to commit number or published version of the release version of an app. Oct 24, 2017 at 11:40
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.

5
  • 11
    +1 for the "Why not?" section.
    – Llepwryd
    Jun 6, 2013 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, 2013 at 22:31
  • 2
    I think the "Why not?" section describes how "Star" works...
    – TWiStErRob
    Mar 7, 2016 at 13:08
  • 4
    Why not just give it a star to save it for later viewing?
    – dude
    Apr 3, 2016 at 9:05
  • 3
    When a project is interesting I would use a star. I agree though with the rest. Oct 24, 2017 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.

1
  • 4
    Note, you could get the same by starring the repo - no need to fork for that.
    – valiano
    May 16, 2019 at 10:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.