Git mergetool生成不需要的.orig文件 [英] Git mergetool generates unwanted .orig files

查看:185
本文介绍了Git mergetool生成不需要的.orig文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我用Kdiff3(以及其他合并工具)尝试合并冲突解决方案时,我注意到在分辨率上创建了一个 *。orig 文件。有没有办法让它不创建额外的文件?

When I do a merge conflict resolution with Kdiff3 (and other merge tool I tried) I noticed that on resolution a *.orig file is created. Is there a way for it to not create that extra file?

推荐答案

git config

A possible solution from git config:

git config --global mergetool.keepBackup false




执行合并后,带有冲突标记的原始文件可以保存为具有 .orig 扩展名的文件。

如果这个变量被设置为 false ,那么这个文件不会被保留。

默认为 true (即保留备份文件)。

After performing a merge, the original file with conflict markers can be saved as a file with a .orig extension.
If this variable is set to false then this file is not preserved.
Defaults to true (i.e. keep the backup files).

另一种方法是不添加或忽略这些文件,如 gitguru文章

The alternative being not adding or ignoring those files, as suggested in this gitguru article,


git mergetool 保存merge-conf使用 .orig 后缀替换文件的版本。

确保在添加和提交合并之前将其删除,或添加 *。orig 到您的 .gitignore

git mergetool saves the merge-conflict version of the file with a ".orig" suffix.
Make sure to delete it before adding and committing the merge or add *.orig to your .gitignore.

贝里克建议在注释中使用:

Berik suggests in the comments to use:

find . -name \*.orig 
find . -name \*.orig -delete

Charles Bailey 建议在他的回答,以了解内部差异工具设置,这些设置也可以生成这些备份文件,无论这些备份文件是什么。

Charles Bailey advises in his answer to be aware of internal diff tool settings which could also generate those backup files, no matter what git settings are.


  • kdiff3有其自己的设置(请参阅目录合并在其手册中)。

  • 其他工具如WinMerge可以有自己的备份文件扩展名(WinMerge: .bak ,如其手册)。

  • kdiff3 has its own settings (see "Directory merge" in its manual).
  • other tools like WinMerge can have their own backup file extension (WinMerge: .bak, as mentioned in its manual).

所以你也需要重置这些设置。

So you need to reset those settings as well.

这篇关于Git mergetool生成不需要的.orig文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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