Git拒绝合并,因为对未更改的文件进行更改 [英] Git refusing to merge because of changes to an unchanged file

查看:251
本文介绍了Git拒绝合并,因为对未更改的文件进行更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个git问题,我想将分支合并到master中,但它拒绝合并,因为它认为我对文件进行了本地更改。执行状态显示没有变化,并且区分文件不会产生任何结果。以下是终端输出:

  $ git checkout产品和内容
转换到分支'ProductsAndContents'

$ git status
分支产品和内容
没有提交(工作目录清理)

$ git checkout master
转换到分支'master'

$ git status
#分支大师
没有提交(工作目录干净)

$ git merge ProductsAndContents
错误:您对本地进行的更改以下文件将被合并覆盖:
tests / unit / src / models / BrandTests.js
请在您合并前提交您的更改或存储它们。
取消

任何帮助或建议都将非常感谢!

解决方案

感谢Andrew Myers对我最初问题的评论,我发现将 core.trustctime 设置为 false 解决了这个问题。

  git config core.trustctime false 

关于inode更改时间的不匹配。我猜这是因为回购是坐在一台机器上的文件共享与我使用的文件系统不同。



感谢所有的建议!

I'm having a git problem where I want to merge a branch into master but it's refusing to merge because it thinks I have local changes to a file. Doing status shows no changes and diffing the files produces nothing. Here's the terminal output:

$ git checkout ProductsAndContents
Switched to branch 'ProductsAndContents'

$ git status
# On branch ProductsAndContents
nothing to commit (working directory clean)

$ git checkout master
Switched to branch 'master'

$ git status
# On branch master
nothing to commit (working directory clean)

$ git merge ProductsAndContents
error: Your local changes to the following files would be overwritten by merge:
    tests/unit/src/models/BrandTests.js
Please, commit your changes or stash them before you can merge.
Aborting

Any help or suggestions would be most appreciated!

解决方案

Thanks to Andrew Myers' comment on my initial question, I discovered setting core.trustctime to false solved the problem.

git config core.trustctime false

Something about mismatching inode change times. I'm guessing this is because the repo is sitting on a fileshare on a machine with a different file system from the one I'm using.

Thanks for all the suggestions!

这篇关于Git拒绝合并,因为对未更改的文件进行更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆