What does “This branch is 0 commits ahead and 0 commits behind master” mean on GitHub?

GitHub screenshot:

enter image description here

  • git submodule foreach: execute read
  • TortoiseGit / Winforms: Resolving Resource.resx When Merging
  • git-lfs: where are the file stored ? how to get them?
  • Do not commit specific changes to the git, but also don't revert them from my local workspace
  • Get the list of changed files after a pull with JGit
  • Someone sent me a pull request, what do I do?
  • There’s only one branch, master. git status says there’s nothing to commit. How is that branch zero commits ahead and behind itself?

    I see this on GitHub forks. Is it just a confusing status message?

  • Git Status Across Multiple Repositories on a Mac
  • How to resolve “delete/modify” conflict caused by “git stash apply”
  • gitpython error when checking if repo is dirty
  • Can I use fetch recurseSubmodules on git clone set in .gitconfig
  • repo about .git/HEAD: error: manifest missing or unreadable — please run init
  • What to do when git on PC will not change account
  • One Solution collect form web for “What does “This branch is 0 commits ahead and 0 commits behind master” mean on GitHub?”

    This is not a bug.

    Once you fork a repo, each of your branch is compared to the branch which is common between the fork and the original repo.
    That gives you a clear indication about you can or not make a pull request.

    In this instance, your branch is master, which is means it is compared with itself, since master is also in the original repo.
    Hence the “0 commit ahead and 0 commit behind” (with itself) message.

    If you had done a commit of your own on, as I mention in “couple of tips on pull request”, on a dedicated branch made from master, then your branch would have been a commit ahead of master.
    You could then have made a pull request, from the owner of the first repo to consider.

    fork

    In any case, the purpose of that message is to remind you that the main goal of a fork is to collaborate and contribute back:

    • if your dedicated branch is behind, you want to rebase it against origin/branch (which you are supposed to keep in sync with the original repo, in other words, you are not supposed to work directly on master) in order to make sure your own work is compatible with the latest commits of the first repo,
    • if your branch is ahead, you could consider making a pull request and giving back.
    Git Baby is a git and github fan, let's start git clone.