Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
&引用;强迫;git通过推送在本地到外部上提交?_Git - Fatal编程技术网

&引用;强迫;git通过推送在本地到外部上提交?

&引用;强迫;git通过推送在本地到外部上提交?,git,Git,可能重复: 我的外部回购协议已经相当过时了。我想把我所有的本地更改推到上游。然而,当我尝试这样做时,我得到以下消息 error: failed to push some refs to 'ssh://mylink' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes (e.g. 'git pull') before pushing again.

可能重复:

我的外部回购协议已经相当过时了。我想把我所有的本地更改推到上游。然而,当我尝试这样做时,我得到以下消息

error: failed to push some refs to 'ssh://mylink'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.

我不想拉,因为如果我这样做的话,外部的变化会打乱我的本地变化。如何覆盖外部资源?

简单地覆盖远程回购怎么样?

git push--force remoterepository

在我看来,这是git受保护的机制。 因为,有人在你之前推过某物,所以你需要拉他的名声,并与你当地的变化建立关系,以确保没有冲突。
因此,也许您应该先尝试获取某人的声誉,然后推动您的更改。

其他人正在使用远程存储库吗?请非常小心-如果这些“外部”更改(远程上的提交而不是本地存储库中的提交)只是您很久以前的提交,这是很好的,因为您已经替换了这些更改。但是,如果它们是别人的作品,你就要通过推来扔掉它——在这种情况下,你确实需要在推之前拉和和解。