为什么分支尖端在它的遥控器后面?

use*_*865 9 git

尽管从远程主机拔出并被告知一切都是最新的,我无法推送到远程主机,因为当前分支位于遥控器的尖端后面.什么?

$ git pull origin master
From https://github.com
 * branch            master     -> FETCH_HEAD
Already up-to-date.
$ git push origin master
To https://github.com
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)

man*_*lds 3

您可能位于不同的分支。git checkout master并尝试。

  • 对此要小心。如果未推送,git checkout master 可以覆盖您的更改 (2认同)