Note that there are some explanatory texts on larger screens.

plurals
  1. POpull-only repo's 'git status' saying the branch is ahead of origin/master. Why?
    primarykey
    data
    text
    <p>So here's the situation:</p> <blockquote> <p>$ git status<br> # On branch master<br> # Your branch is ahead of 'origin/master' by [x] commits.<br> #</p> </blockquote> <p>There are several questions about this on SO already, but none seem to specifically address the type of scenario I have. <a href="https://stackoverflow.com/questions/2432579/git-your-branch-is-ahead-by-x-commits/3323933#3323933">This answer</a> to one of the questions comes closest, but doesn't go into detail.</p> <p>I'll just quote it verbatim:</p> <blockquote> <p>If you get this message after doing a "git pull remote branch", try following it up with a "git fetch".</p> <p>Fetch seems to update the local representation of the remote branch, which doesn't necessarily happen when you do a "git pull remote branch".</p> </blockquote> <p>That tip does indeed work. But "doesn't necessarily happen?" Why not? I need to understand this. What is pull not doing?</p> <p>I don't want to take over that question, so here's my scenario in detail:</p> <p>Three computers involved. The Mac on which I develop, my home server where the git repo (i.e. origin/master) lives and a Webfaction account that pulls from that server.</p> <p>I do commits and <code>git push origin master</code> only on the Mac. The only command that ever gets run on Webfaction as part of the normal workflow is <code>git pull origin master</code> (as part of a Fabric deployment script). I don't modify code there. I'm a lone developer, so neither does anyone else.</p> <p>Every now and then I log in to Webfaction and check on things, including a <code>git status</code>. Inevitably, I always get the "Your branch is ahead..." message. Running <code>git fetch</code> makes the message go away.</p> <p>I'm about to add <code>git fetch</code> to the Fabric script to be done with this issue, but I want to know why that needs to be done, especially on a pull-only clone of origin/master. I'm not deeply versed in Git though I use the basic functionality daily, so a newbie-friendly explanation would be appreciated.</p> <p><strong>Update</strong> as requested, the relevant bits from <code>config</code>:</p> <pre><code>[remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = git@[server_address]:[path/to/repo.git] [branch "master"] remote = origin merge = refs/heads/master </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload