title: Why do GitHub and the git command line give different results for merge status & commits ahead/behind?
body: <p>When I run</p>
  
  <pre><code>git branch --no-merged
  </code></pre>
  
  <p>on <a href="https://github.com/CDLUC3/mrt-dashboard" rel="nofollow noreferrer">this repo</a>, the first listed branch is one called <a href="https://github.com/CDLUC3/mrt-dashboard/tree/dcxl" rel="nofollow noreferrer">dcxl</a>.</p>
  
  <p>But when I view the branch in GitHub, what I see is just</p>
  
  <blockquote>
    <p>This branch is 1291 commits behind master.</p>
  </blockquote>
  
  <p>And when I go to GitHub’s pull request interface, I get:</p>
  
  <blockquote>
    <p><strong>There isn’t anything to compare.</strong></p>
    
    <p><strong>master</strong> is up to date with all commits from dcxl.</p>
  </blockquote>
  
  <p>According to <a href="https://stackoverflow.com/a/27940027/27358">this answer</a>, the way to see commits ahead/behind is</p>
  
  <pre><code>git rev-list --left-right --count [BRANCH]...master
  </code></pre>
  
  <p>When I run this, I get:</p>
  
  <pre><code>$ git rev-list --left-right --count master...dcxl
  426     1717
  </code></pre>
  
  <p>I read this as “Branch <code>dcxl</code> is 426 commits ahead, 1717 commits behind master.” </p>
  
  <p>Now, 1717 - 426 = 1291, so there’s clearly some relationship between the <code>git rev-list</code> output and what GitHub’s telling me, but GitHub seems to be somehow identifying those 426 “ahead” commits with 426 of the 1717 “behind” commits in a way that <code>git rev-list</code> doesn’t.</p>
  
  <p>From some answer, I’m not sure which, I found the <code>--no-merges</code> option, and tried that, in case merge commits were the difference:</p>
  
  <pre><code>$ git rev-list --left-right --count --no-merges dcxl...master
  396     1610
  </code></pre>
  
  <p>Still different.</p>
  
  <p>I have other repos where the <code>git rev-list</code> output exactly matches GitHub’s. And this particular repo, including branches, was migrated from Mercurial, so there could be all kinds of shenanigans in the history. But I'm pretty sure GitHub is right, here, and there's nothing in this branch that needs merging.</p>
  
  <p>But how can I check that from the command line? Why are the numbers I'm getting different, and what commands / options would I need to get the same numbers GitHub is giving me?</p>