如何忽略Git pull上的以下错误消息?

您对以下文件的本地更改将被合并覆盖

如果我想覆盖它们怎么办?

我试过像git pull-f这样的方法,但没有任何效果。

要明确的是,我只想覆盖特定的更改,而不是所有更改。


当前回答

只需提交本地更改并合并提交-a

其他回答

如果要放弃对一个文件的本地更改,可以执行以下操作:

git checkout -- <file>

然后,您可以使用最新版本覆盖文件,只需执行以下操作:

git pull

我是git新手,不确定我的解决方案是否是个好主意。

我测试了所有答案,但没有一个对我有用!

但我找到了另一个解决方案:

1. Backup both of local and repository versions of the file.
2. Delete the file from repository.
3. git add .
4. git commit
5. git push

希望这有帮助。

由于您的分支位于xx提交的“origin/dev”之后,因此可以快速转发。请尝试以下命令:

git checkout .
git pullenter code here

希望这能解决你的问题。

对我来说,这是有效的:-

首先,我清理了所有未跟踪的文件,运行->gitclean-f。数字拉力

最简单的解决方案是:

git reset --hard && git pull