Why should I push the changes that I just pulled from the source in Git?

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

One thing that still puzzles me is that when the origin changes were made, and I do git pull origin masterto update my local repository, git statusthen tells me that X is ahead of origin, where X is the number of commits that I just pulled out.

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

So, I always do git push origin masterafterwards, but I'm just wondering if anyone can explain why this is necessary, and if I can do it wrong.

It seems to me that if I just pulled the changes from the source, the two repos should be the same. So why did I say I'm ahead of lineage? Is this due to the fact that this is a bare repository?

Here the situation is a little more detailed, for clarity:

I have an empty Git repository on a remote server. This repo has two clones: "dev" on my local machine and "setup" on the same server as the source.

When I make changes to dev, I then make git push origin masterthem to the bare repo hub. Then I sign up to the remote server, cdin the "intermediate" repo and do git pull origin masterit to update the "stage" from the "hub".

After I did this by comparing the hub and intermediate commit records with git log --pretty=oneline, I see that they are identical.

, git status "staging", :

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

, git push origin master , :

$ git push origin master
Everything up-to-date

, , , ...

+3
2

man git-pull:

next:

$ git pull origin next

next FETCH_HEAD, . , , :

$ git fetch origin
$ git merge origin/next

.

, Git , origin/master, . git pull origin master ( ), . git fetch origin , ( manpage).

AFAIK, git pull (, git pull origin), .git/config , , .

+5

? , git pull , HEAD origin HEAD

+1

All Articles