简体   繁体   English

GIT分支位于前面或原始/主节点没有任何提交

[英]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. 同样,该存储库由生产服务器上的gitlab安装托管。

-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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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