如何仅通过文件模式更改来大规模解决Git冲突? [英] How to mass-resolve Git Conflicts with only File Mode changes?

查看:104
本文介绍了如何仅通过文件模式更改来大规模解决Git冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试合并两个存储库,并且只有几个真实"冲突,但是大约有70个两者都添加"的文件冲突.但是,当查看git diff时,它仅显示文件模式已更改.

I am trying to merge two repositories, and there are only a couple of "real" conflicts, but there are about 70 file conflicts of "Both added". When viewing a git diff, however, it only shows file mode changed.

批量接受当前文件模式并忽略传入文件模式的最佳方法是什么?

What would be the best way to mass-accept the current file mode and ignore the incoming file mode?

一些背景: 这两个存储库具有相同的代码,但是其中一个已经通过SVN进行了跟踪,因此没有历史记录.我现在使用git-svn对其进行跟踪,并将其与当前git存储库合并.

A little background: These 2 repositories are of the same code, but one has been tracked through SVN, so doesn't have a history. I'm using git-svn to track it now and merge it with the current git repository.

合并时传入的冲突显示为: 冲突(添加/添加):在framework/file/name.php中合并冲突 自动合并失败;解决冲突,然后提交结果.

The incoming conflicts on merge appear as: CONFLICT (add/add): Merge conflict in framework/file/name.php Automatic merge failed; fix conflicts and then commit the result.

Git状态显示: 都添加了:framework/file/name.php

Git status shows: both added: framework/file/name.php

如果我使用git mergetool,它不会显示任何冲突.使用这种方法浏览每个文件需要很长时间.

If I use the git mergetool, it does not show any conflicts. Going through each file using this method takes a very long time.

推荐答案

因此,在尝试了所有各种合并策略并确定需要从存储库中采用文件模式之后,放弃了本地文件模式,这是我的最佳解决方案出现是为了使用: git checkout --theirs <remote/branch> -- path用于文件模式更改,并且git mergetool用于代码冲突解决. 使用git diff,我可以看到哪些文件是文件模式更改,哪些是文件代码更改. git merge使用--recursive -Xours作为默认合并策略.

So after trying all the various merge strategies, and determining that I needed to take the file mode from the repository, discarding the local file mode, the best solution I came up was to use: git checkout --theirs <remote/branch> -- path for the filemode changes, and used git mergetool for the code conflict resolution. Using git diff, I could see which files were filemode changes, and which were file code changes. git merge uses --recursive -Xours as the default merge strategy.

有一个git config变量:core.fileMode,可以忽略文件模式的更改. 请参阅:如何使Git忽略文件模式(chmod)更改?

There is a git config variable: core.fileMode that can ignore file mode changes. See: How do I make Git ignore file mode (chmod) changes?

这篇关于如何仅通过文件模式更改来大规模解决Git冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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