拒绝git推

dra*_*sca 5 git push github

To git@github.com:xxx/xxxxx.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:xxx/xxxxx.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'Note about
fast-forwards' section of 'git push --help' for details.
Run Code Online (Sandbox Code Playgroud)

当我试图推动一些变化时,我收到了这个错误.当我尝试从回购中获取时,我得到了

From github.com:xxx/xxxxx
 * branch            master     -> FETCH_HEAD
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能解决这个问题?到目前为止,基本上只有我在回购中,我只有两次来自其他人.我需要做一个合适的合并吗?

Jar*_*Par 11

推送失败,因为您的引用位于远程存储库的后面.提取操作不仅带来下来的内容和远程仓库的裁判,但不更新你的裁判的变化.因此,它无法解决阻止推送的问题.您需要执行pull操作或手动合并远程refs的本地版本.

  • 你也可以做git rebase origin/master然后git merge origin/master来保持历史的线性而不是太乱. (5认同)