Meaning of Github Ahead/Behind Metrics

后端 未结 4 1640
予麋鹿
予麋鹿 2020-12-04 15:02

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

4条回答
  •  爱一瞬间的悲伤
    2020-12-04 16:03

    The metrics like those you can see for this project describe, compare to a branch from the repo (like master):

    • the number of new commits that the GitHub repo has done compared to another branch of another repo: those are the behind commits: the other repo is behind compared to the current repo (see those commits).
    • the number of new commits another branch of another repo has done compared to the current repo: those are the ahead commits: the other repo is ahead compared to the current repo (see those commits).

    The technical detail is illustrated by the script "determining which repos are ahead/behind origin":
    It is about checking:

    • what commits are reachable from another branch, but not from the local branch: ahead
      git rev-list "$localref..$anotherref"
    • what commits are reachable from the local branch, but not from the other branch: behind
      git rev-list "$anotherref..$localref"

提交回复
热议问题