The git repository on the server is inexplicably ahead of 'origin/master' by N commits.. What are we going to do with it?

larvel project, local development, upload cloud warehouse, pull remote warehouse directly on the server.
after the sudden discovery of, git status today, it prompts your branch is ahead of "origin/master" by 5 commits.
to compare the commit id, with the remote repository exactly the same, without exception.
then ignores it and git pull origin master,pull two commit directly to the latest version, and then git status, discovers that after it becomes ahead of "origin/master" by 7 commits.
, one commit,ahead of is added to each pull. But Mingming and the remote warehouse belong to Synchronize.
every time pull sees information, it is merged by Fast-forward.

how can we solve this problem? (delete library and re-clone does not count)

Git
Apr.01,2021

using git pull origin master each time will keep the local node pointing to the remote origin/master (pointing not to update), so when the new commit is obtained from the remote end, the direction of the commit relative to the local node (the old commit at the remote end) will prompt "ahead".
solution:

  1. use the git fetch command directly to fix the current problem and point locally to the latest remote node
  2. use git pull for subsequent updates, without origin master

is your origin fork ?

you say you are on the server pull , and then this prompt is also on the server? Then take a look at what the origin on the server points to first. no, no, no. git remote-v look at the output

if you are fork and you haven't push , then you can just push once

.
Menu