Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning of Github Ahead/Behind Metrics

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?

like image 652
LikeMaBell Avatar asked Jul 10 '11 20:07

LikeMaBell


People also ask

What does behind or ahead mean in bitbucket?

What the the behind/ahead column is telling you that you have made changes on your branch that has not yet made it to the default branch (the branch Bitbucket is comparing against), meaning your branch is ahead.

What does commits behind Master mean?

Local Master branch is behind the remote Master branch. This means every locally created branch is behind. Before preceding, you have to commit or stash all the changes you made on the branch behind commits.


1 Answers

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.

like image 73
rtomayko Avatar answered Sep 28 '22 00:09

rtomayko