简体   繁体   中英

GIT branch is ahead or origin/master with nothing to commit

How can I be ahead of my origin/master when I don't have anything to commit?

I can "fix" it by pushing, but there doesn't seem to be anything to fix.

Don't know if it masters, but this is my production server which I never make direct changes on but only update by pulling. Also, the repository is hosted by a gitlab installation which is on the production server.

-sh-4.1$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 10 commits.
#   (use "git push" to publish your local commits)
#
nothing to commit, working directory clean
-sh-4.1$ git push origin master
Everything up-to-date
-sh-4.1$ git status
# On branch master
nothing to commit, working directory clean
-sh-4.1$

由于您没有要提交的内容,因此可以将本地主机重置为远程主机上的master分支。

git reset --hard <enter_commit_to_revert_to>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM