3

在推送中发生以下错误

git.exe push    "origin" master:master

To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'non-fast forward'
section of 'git push --help' for details.
To //oht-fsv1/Source/Git/Test
! [rejected]        master -> master (non-fast forward)

怎么了?

4

1 回答 1

7

来自git push

当更新将用于指向提交 A 的分支(或更一般地,引用)更改为指向另一个提交 B 时,当且仅当 B 是 A 的后代时,它才称为快进更新。

在从 A 到 B 的快进更新中,原始提交 A 在其之上构建的提交集是新提交 B 在其之上构建的提交的子集。因此,它不会丢失任何历史记录。

相反,非快进更新将丢失历史记录。

所以这将防止你失去历史:git pull先尝试,解决潜在的冲突,然后“ git push”结果。

于 2009-11-05T04:54:50.690 回答