Meaning of Github Ahead/Behind Metrics

LikeMaBell picture LikeMaBell · Jul 10, 2011 · Viewed 20.8k times · Source

In plain language (hopefully with a simple example), what do the ahead/behind metrics on a Github repo's branch mean?

And what are the implications for that branch and the attention it's receiving? Is being "behind" a bad sign for a branch?

Answer

rtomayko picture rtomayko · Jul 11, 2011

Ahead is the number of commits on this branch that do not exist on the base branch. Behind is the number of commits on the base branch that do not exist on this branch.

Ahead and behind are almost like a kind of "age" metric. The ahead number tells you roughly how much impact the branch will have on the base branch should it be merged. The behind number tells you how much work has happened on the base branch since this branch was started.

I find the behind number really useful for judging whether a branch is likely to merge cleanly. When a lot of work has happened on the base branch, it's more likely that the two branches have modified the same line(s). When behind is large, it's a sign that you should probably merge the base branch into this branch to sync up. Once you merge the base branch into this branch, behind will be 0.