本文介绍了Git pull错误:对以下文件的本地更改将被合并覆盖:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从远程分支中获取更改,但得到一个没有意义的错误



当我做时

  git pull 

p>

 错误:对以下文件的本地更改将被合并覆盖:
file / name / path
一些/更多/文件名路径
请在您合并之前提交您的更改或隐藏它们。
中止

问题是我没有需要提交的更改
何时我做
git status

 #分支master 
#你的分支和'origin / master'分别有
#和2个和7个不同的提交。

没有提交(工作目录清理)

没有工作变更

我试过 git reset --hard HEAD 但这并没有帮助

有什么想法?



文件位于NFS文件系统上,可能与此有关。
这是在OSX上



谢谢




更新:
这个问题必须对NFS做些事情,因为当我去到原始源代码并从那里做了git pull时,一切正常,它修复了这个实例,但仍然不确定它为什么会导致问题NFS。

解决方案

我有同样的问题,并且取/ rebase答案对我不起作用。以下是我如何解决它:



我删除了导致问题的文件,将其检出,然后成功取出。


  1. rm file / name / path / some / more / filenamepath
  2. git checkout file / name / path / some / more / filenamepath
  3. li>
  4. git pull


I am trying to pull changes from remote branch but getting an error which doesn't make sense

when I do

git pull

I get back

error: Your local changes to the following files would be overwritten by merge:
file/name/path
some/more/filenamepath
Please, commit your changes or stash them before you can merge.
Aborting

Problem is I have no changes that need to be committedWhen I do git status

# On branch master
# Your branch and 'origin/master' have diverged,
# and have 2 and 7 different commits each, respectively.
#
nothing to commit (working directory clean)

there are no working changes

I've tried git reset --hard HEAD but that didn't help

any ideas?

Files are on the NFS file system, maybe that has something to do with.This is on OSX

Thanks


UPDATE:This issue has to do something with NFS, because when I went to the original source and did git pull from there everything worked fine, which fixed it for this instance, but still not sure exactly why it causes issues with NFS.

解决方案

I had this same issue, and the fetch/rebase answer didn't work for me. Here's how I solved it:

I deleted the file that was causing the issue, checked it out, and then pulled successfully.

  1. rm file/name/path/some/more/filenamepath
  2. git checkout file/name/path/some/more/filenamepath
  3. git pull

这篇关于Git pull错误:对以下文件的本地更改将被合并覆盖:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 23:19