title: 'git pull origin mybranch' leaves local mybranch N commits ahead of origin. Why?
body: <p>I just observed something odd about <code>git pull</code>, which I don't understand.</p>
  
  <p>On Friday, I worked on a local branch. let's call it <code>mybranch</code>. Before leaving the office I pushed it to origin (which is my github repo): <code>git push origin mybranch</code>.</p>
  
  <p>Yesterday at home, I <code>pull</code>ed mybranch to my laptop, did some more coding, and then pushed my changes back to github (origin).</p>
  
  <p>Now I'm at work again, and tried to pull the changes from yesterday to my work machine (I didn't change anything in my work place's local repo over the weekend):</p>
  
  <pre><code>git pull origin mybranch
  </code></pre>
  
  <p>that caused a fast forward merge, which is fine. I then did a <code>git status</code>, and it said:</p>
  
  <pre><code># On branch mybranch
  # Your branch is ahead of 'origin/mybranch' by 6 commits.
  #
  nothing to commit (working directory clean)
  </code></pre>
  
  <p>Huh? How can it be 6 commits ahead when I didn't even touch it over the weekend, AND just pulled from origin? So I ran a <code>git diff origin/mybranch</code> and the diffs were exactly the 6 changes I just pulled from remote.</p>
  
  <p>I could only "fix" this by running <code>git fetch origin</code>:</p>
  
  <pre><code>From git@github.com:me/project
  af8be00..88b0738  mybranch -&gt; origin/mybranch
  </code></pre>
  
  <p>Apparently, my local repo was missing some reference objects, but how can that be? I mean, a pull does a fetch already, and I didn't work on anything except that branch, so a <code>git fetch origin</code> and <code>git fetch origin mybranch</code> should have the same result?</p>
  
  <p>Should I always use <code>git pull origin</code> instead of <code>git pull origin branchname</code>?</p>
  
  <p>I'm confused.</p>