0

The local master is on Centos and being used from the command line.

The remote master is on GitHub. There's only ever one remote and I've checked it's the correct one.

If I do git status and see this:

Your branch is ahead of 'origin/master' by 3 commits.

then do a git fetch and a git pull (and see some changes being downloaded and merged without any problems), why would I see this afterwards?

git status
Your branch is ahead of 'origin/master' by 4 commits.

How is it possible that the local branch is ahead by more commits following a pull, after no activity in the local repo?

When I do git log master ^origin/master I see a list of commits. This command should show which commits are in local but aren't in remote. But if I pick a commit ID from the list, I can find it in Github.

I'd really be interested in an explanation for this.

John Horner
  • 272
  • 2
  • 13
  • `git log --graph --oneline --all` will probably help, the default logs are for showing recent changes not for showing history structure. – jthill Aug 15 '22 at 03:47
  • 1
    The default CentOS Git versions tend to be *ancient*. These versions may behave a little differently, so make sure you show the output of `git --version` *and* the exact commands used. – torek Aug 15 '22 at 08:02
  • @AmbroseChapel (what happened to John Horner?) OK - I'm now betting that you ran `git fetch origin ` rather than just `git fetch`. In pre-1.8.4 Git, this fails to update the remote-tracking name. – torek Aug 17 '22 at 08:16
  • Hi sorry for adding my comment here @john-horner I thought I was in another tab. I deleted. – AmbroseChapel Aug 18 '22 at 22:36
  • Thanks for that @torek, the version on my server is indeed quite old (1.8.3.x which is from 2012). I'm pretty sure you're right about `git fetch origin ` but I don't understand about the "failed to update the remote-tracking name" part. The name was always "master". – John Horner Aug 18 '22 at 22:43
  • 2
    Your branch name is `master`. Their branch name *in their repository* is also `master`. Your Git software renames their branch name to your remote-tracking name, `origin/master`, so that it does not collide with your own `master`. Runnng `git fetch` will update `origin/master`, so that afterwards, `git status` reports "up-to-date" (accurately). But running `git fetch origin master` *fails* to update `origin/master` in this ancient Git, so that `git status`, which reads your `origin/master` that was not updated, reports out of date results. – torek Aug 19 '22 at 12:21

0 Answers0