On the local machine I do

$ git push origin master 

Then on the remote

 $ git status nothing to commit, working directory clean $ git pull origin master remote: Counting objects: 10, done. remote: Compressing objects: 100% (8/8), done. remote: Total 10 (delta 6), reused 0 (delta 0) Unpacking objects: 100% (10/10), done. * branch master -> FETCH_HEAD Updating 2df9bf3..2447f2a Fast-forward $ git status # On branch master # Your branch is ahead of 'origin/master' by 1 commit. # (use "git push" to publish your local commits) # nothing to commit, working directory clean 

Why did a commit appear? What to do with him?

  • most likely occurred merdzh. git log and see what happened there. - KoVadim
  • Yes, there have been some changes in the files. They suit me what to do with a commit? Or how to make changes on a remote server? - Ptica
  • push if satisfied and remove (reset) if not needed. - KoVadim
  • Why push her? I took it from the remote repository only .. - Ptica
  • @KoVadim, everything is much simpler. see my answer. - aleksandr barakin

2 answers 2

pre-note: a git branch is just a floating pointer to a commit.


team:

 $ git pull origin master 

did not update (and should not have updated) the origin/master pointer, only the master pointer, “moving” it to one (in your case) commit “forward”.

This is the status command and tells you that your current master pointer is “ahead” (ahead) of the origin/master pointer.

in order to “correct the omission”, it is sufficient to perform, for example:

  $ git fetch From url-репозитория xxxxxxx..yyyyyyy master -> origin/master 

In the above output, you can see that the origin/master link is updated.

after that, the status command should not tell you about a discrepancy between pointers.


but in general, it is not clear why you are writing a git pull origin master , given that the current branch is clearly connected ("set upstream") to the master branch in the origin repository. it's simple enough:

 $ git pull 

and you will not have the differences described in the question.

  • if you are given an exhaustive answer, please tick it accepted ("tick" to the left of the answer). - aleksandr barakin

Roll back to the previous commit: git --force 2df9bf3 then make a pool, commit and push in this order.

  • git --force 2df9bf3 - this entry is not clear. Actions are done on a remote server? And it will not be a repetition of the same actions that I did before? - Ptica
  • @Ptica you do not yet have access to the remote repository, as there are conflicts in commits on your local. if you need to rollback the commit on the remote repository add before recording: git push --force 2df9bf3 - raviga