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

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

问题描述

当我使用 Kdiff3(以及我尝试过的其他合并工具)进行合并冲突解决时,我注意到在解决时会创建一个 *.orig 文件.有没有办法让它不创建那个额外的文件?

解决方案

一个可能的解决方案来自 git 配置:

git config --global mergetool.keepBackup false

<块引用>

执行合并后,带有冲突标记的原始文件可以保存为带有 .orig 扩展名的文件.
如果此变量设置为 false,则不会保留此文件.
默认为 true(即保留备份文件).

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

<块引用>

git mergetool 使用.orig"后缀保存文件的合并冲突版本.
确保在添加和提交合并之前将其删除,或者将 *.orig 添加到您的 .gitignore.

Berik 建议 在评论中使用:

查找.-name *.orig寻找 .-name *.orig -delete

Charles Bailey他的回答要注意内部差异工具设置,它也可以生成那些备份文件,无论是什么git设置是.

  • kdiff3 有自己的设置(请参阅其手册中的目录合并").
  • WinMerge 等其他工具可以有自己的备份文件扩展名(WinMerge:.bak,如 其手册).

因此您还需要重置这些设置.

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?

解决方案

A possible solution from git config:

git config --global mergetool.keepBackup false

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).

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

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 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 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天全站免登陆