GIT RACERBlog

How GitHub counts contributions

By Erin Kerr ยท

GitHub counts a commit as a contribution only if its author email is linked to your account, it sits in a standalone repository (not a fork), and it is on the default branch or gh-pages. Issues, pull requests, reviews and discussions count too, with their own rules.

I ran into all of this while building Git Racer. A race is only fair if both people are measured the same way, so I had to learn exactly what the green squares mean (and why mine sometimes had holes). This post is the version I wish I'd had: the rules first, then a checklist for gaps.

What counts as a contribution

GitHub's docs split activity into things that always count and things that count under conditions. Here is the list from GitHub's contributions reference:

Activity Counts?
Creating a new repository Always
Forking a repository Always
Commits If they meet the commit rules below
Opening an issue If it's in a standalone repository, not a fork
Proposing a pull request If it's in a standalone repository, not a fork
Submitting a pull request review Sometimes, per the docs
Opening or answering a discussion If it's in a standalone repository, not a fork

Think of the graph like a turnstile at a race track. Plenty of people walk past, but only the ones with the right ticket get counted.

The rules for commits

A commit has to meet all three conditions, according to the docs:

  1. The author email is connected to your account. The GitHub-provided noreply address works too. You can check a commit's author email by adding .patch to the commit's URL.
  2. It is in a standalone repository, not a fork.
  3. It is on the default branch or the gh-pages branch.

On top of that, you need a tie to the repository: you're a collaborator or a member of the owning organization, you forked it, or you opened a pull request or issue in it.

Why your graph has gaps

Most gaps come from a handful of causes, all described in GitHub's troubleshooting page.

The email doesn't match

Say Priya commits from a new laptop where git config user.email is her old university address. The commits are real, but GitHub can't link them to her account, so the squares stay empty. Adding that address to her GitHub account fixes it, and the graph can take up to 24 hours to refresh.

The commit is on a feature branch

Commits only count on the default branch or gh-pages. If you've been working on a branch, open a pull request into the default branch and the work gets counted once it lands there.

The commit is in a fork

Commits made in a fork don't count. If you want them to, open a pull request to the parent repository.

It's just slow

A new commit can take up to 24 hours to appear.

Rewritten history

If you squash or force-push, your profile may keep counting commits that are no longer in the visible history. The docs call this a stale count, and GitHub Support may be able to rebuild it.

Dates and time zones

Commits use the time zone information in the commit timestamp, and on your profile the author date decides which day a commit lands on. Pull requests and issues opened on GitHub use your browser's time zone.

So a late-night commit can land on a different day than you expect, which is worth knowing if you care about a streak.

Private contributions

You can choose to show private contributions on your profile. People without access to those repositories see the number of contributions you made each day, but no details. A busy day with no public repository attached usually means private work.

Display limits

GitHub limits how many items it displays for some contribution types, so if you've hit that limit the graph may not show all of your contributions.

How this affects a Git Racer race

Git Racer reads your GitHub contribution calendar, so a race scores the same squares you see on your profile, and that includes all contribution types, not only commits. Every race covers one ISO week, Monday to Sunday UTC, and resets each Monday.

So if your commit isn't on the graph, it isn't in the race. Check the email and branch rules above before a head-to-head. When you're ready, start a race on Git Racer against a friend or a famous developer.

FAQ

Do private repository commits count?

Yes, if you choose to show private contributions on your profile. Others see only the daily count.

Do commits in a fork count?

No. Open a pull request to the parent repository for them to count.

How long until a commit shows up?

Up to 24 hours.

Do pull requests and issues count as contributions?

Yes, when opened in a standalone repository rather than a fork.

Start a race on Git Racer