Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4055130
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T14:39:45+00:00 2026-05-20T14:39:45+00:00

I have a Git repository on my local machine that I cloned from my

  • 0

I have a Git repository on my local machine that I cloned from my remote server. The Git repository that I cloned from is a bare repository.

One thing that still puzzles me is that, when changes have been made on origin and I do git pull origin master to update my local repository, git status then tells me that I’m X commits ahead of origin, where X is the number of commits I just pulled.

This is despite the fact that the commit logs are already identical.

So I always do a git push origin master afterwards, but I was just wondering if anybody could explain why this is necessary and whether I might not be doing this incorrectly.

It seems to me that if I just pulled the changes from origin, the two repos should be identical. So why am I told that I’m ahead of origin then? Is this related to the fact that it’s a bare repository?

Here’s the situation in a bit more detail, for clarity’s sake:

I have a bare git repo (hub) on a remote server. That repo has two clones: “dev” on my local machine and “staging”, on the same server as origin.

When I make changes on dev, I then git push origin master them to the bare “hub” repo. Then I log on to the remote server, cd to the “staging” repo and do git pull origin master to update “staging” from “hub”.

After I’ve done this, if I compare the hub and staging commit logs using git log --pretty=oneline I can see that they’re identical.

However, if I do git status in the “staging” directory I get the following:

$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)

So then I usually do git push origin master from there, and I’m told:

$ git push origin master
Everything up-to-date

Everything works properly, but I just have this nagging question in my mind whether I didn’t make a mistake when setting the repos up, or whether this is normal…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T14:39:45+00:00Added an answer on May 20, 2026 at 2:39 pm

    According to man git-pull:

    Merge into the current branch the remote branch next:

    $ git pull origin next
    

    This leaves a copy of next temporarily in FETCH_HEAD, but does not update any remote-tracking branches. Using remote-tracking branches, the same can be done by invoking fetch and merge:

    $ git fetch origin
    $ git merge origin/next
    

    Emphasis is mine.

    Basically, Git is telling you that your updated master is ahead of origin/master, which is a remote tracking branch for master. Since this tracking branch is not being updated by git pull origin master (as indicated in the man page), you are technically ahead of it. Calling git fetch origin updates your remote tracking branches and then you can merge that tracking branch in by hand (as indicated in the second manpage example).

    AFAIK, if you do not specify a branch name with git pull (e.g. git pull origin), it will read .git/config for what it should fetch and the remote tracking branches will be updated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a remote git repository and I have cloned one branch git clone
I have various Git projects that are on my local machine. I have a
Trying to set-up a git server on my local dev machine and have been
I have a local git repository which tracks a remote SVN repository via git
I have heard that it is possible to have a local Git repository on
I have an issue with a new remote repository that when cloned using Tower,
I have a local git repository with two folders running on my windows machine.
I have an existing Git repository on my local machine. I would like to
Here is the situation. I have a remote git repository on Server A. Also,
I have setup a git repository in a linux server, and installed the latest

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.