git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jay Soffian <jaysoffian@gmail.com>
To: Srirang Doddihal <om.brahmana@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Git repo on a machine with zero commits is ahead of remote by 103 commits.. !
Date: Tue, 25 Jan 2011 02:23:05 -0500	[thread overview]
Message-ID: <AANLkTinC7yvHJj_onRRWBYaZ23Pvs0JB2DJT44Jy-JLG@mail.gmail.com> (raw)
In-Reply-To: <AANLkTikj06sjTbNd8afk9cY2=_Hy+kT+J1NCjR-fKP5J@mail.gmail.com>

On Tue, Jan 25, 2011 at 12:48 AM, Srirang Doddihal
<om.brahmana@gmail.com> wrote:

> 1) Why does "git status"  say that the local repo on the deployed
> machine (where no commits are made) is ahead of the remote by 103
> commits? (This number, 103, increases with every "git pull origin
> master" and very likely the change is equal to the number of commits
> pulled)

git status is comparing refs/heads/master, aka master, to its
remote-tracking branch, refs/remotes/origin/master, aka origin/master.

master is ahead of origin/master because you've been updating the
former but not the later, with your pull invocation.

> 2) Why is "git log orign/master" stuck at a Jan 8th commit?

Because you've been saying "git pull origin master", git has been
doing the following:

- contacting origin and fetching all commits in its master not in your
local repo
- locally updating FETCH_HEAD with the results of that fetch
- performing a merge operation of FETCH_HEAD into your local master
- because you haven't made any local commits, that is a fast-forward operation
- updating your work tree

However, git is not updating your remote-tracking branch (origin/master).

> * How can I set these right?

Just do a "git pull" or "git pull origin". By not explicitly giving
pull a branch, it consults two configuration variables in your
.git/config for the currently checked out branch to figure out what
you want it to do, namely:

  branch.master.remote
  branch.master.merge

Also in this case, it updates the origin/master remote-tracking branch.

(I think there has been previous discussion about this behavior - it
seems broken to me that "git pull <remote> <branch>" doesn't update
the corresponding remote-tracking branch <remote>/<branch> in the case
where "git pull [<remote>]" would normally do so according to that
repo's .git/config.)

j.

  parent reply	other threads:[~2011-01-25  7:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-25  5:48 Git repo on a machine with zero commits is ahead of remote by 103 commits.. ! Srirang Doddihal
2011-01-25  7:22 ` Johannes Sixt
2011-01-25  7:23 ` Jay Soffian [this message]
2011-01-25 23:09   ` Srirang Doddihal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTinC7yvHJj_onRRWBYaZ23Pvs0JB2DJT44Jy-JLG@mail.gmail.com \
    --to=jaysoffian@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=om.brahmana@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).