Why does git think master is ahead of the remote, when it's actually behind?
<p>I have a repo on GitHub where someone else has created a couple of new branches, and I have clicked "merge" on the branches on GitHub to merge them into master. </p>

<p>On GitHub's commit history, I can see four commits: the person's commit on the branch (<code>hash1</code> and <code>hash2</code>), followed by my merge commits (<code>hash3</code> and <code>hash4</code>). This is fine.</p>

<p>But I am confused about my local git status, and how to get it into sync with the remote. I am on the master branch. </p>

<p>If I type <code>git whatchanged</code>, the last commits I see locally are the person's commit on the branch (<code>hash1</code> and <code>hash2</code>), not the remote merge commits (<code>hash3</code> and <code>hash4</code>). </p>

<p>If I type <code>git status</code>, I see the following:</p>

<pre><code>On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean
</code></pre>

<p>Why does git think that <code>hash1</code> and <code>hash2</code> puts it ahead of remote master? Isn't it instead <em>behind</em> master, because it doesn't have <code>hash3</code> and <code>hash4</code>?</p>

<p>If I type <code>git pull origin master</code>, I see: </p>

<pre><code>From github.com:myorg/myrepo
 * branch            master     -&gt; FETCH_HEAD
Already up-to-date.
</code></pre>

<p>So it doesn't seem to know about <code>hash3</code> and <code>hash4</code>. </p>

<p>I'm now scared of making a new commit locally in case I mess up master, have unnecessary extra merges, etc. What should I do to just get everything up to date with remote master, and start with a clean slate?</p>

<p>UPDATE: Here's the output of <code>git remote -v</code>:</p>

<pre><code>origin  git@github.com:myorg/myrepo.git (fetch)
origin  git@github.com:myorg/myrepo.git (push)
</code></pre>

<p>And here's the output of <code>git log --graph --decorate --pretty=oneline --abbrev-commit --all</code>:</p>

<pre><code>*   2315aed (HEAD -&gt; master) Merge branch 'master' of github.com:myorg/myrepo
|\
| *   9de7505 (origin/master) Merge pull request #12 from myorg/reposition-video
| |\
* | \   0d1d845 Merge branch 'reposition-video' of github.com:myorg/myrepo
|\ \ \
| |/ /
|/| /
| |/
| * 1067905 (origin/reposition-video, reposition-video) Move the video below the fold.
* |   a5e8d96 Merge pull request #11 from myorg/update-install-docs
|\ \
| |/
|/|
| * 9744ffa Minor documentation fixes.
|/
* 4b4d507 Update README.
* 89da81b Add latest code for feature.
</code></pre>

<p>Ah, so if I do <code>git log</code> locally I can actually see <em>four</em> merge commits, not two! They just don't show up in <code>git whatchanged</code>, which is partly why I was confused. </p>

<p>Question now: how can I undo these extra local merges, and get back into sync with remote, which has just two merge commits? And how did they happen in the first place - I guess there must be some automatic merging going on on during <code>git pull</code>?</p>