Git mergetool 生成不需要的 .orig 文件 [英] Git mergetool generates unwanted .orig files
问题描述
当我使用 Kdiff3(以及我尝试过的其他合并工具)进行合并冲突解决时,我注意到在解决时会创建一个 *.orig
文件.有没有办法让它不创建那个额外的文件?
一个可能的解决方案来自 git 配置
:
git config --global mergetool.keepBackup false
<块引用>
执行合并后,带有冲突标记的原始文件可以保存为带有 .orig
扩展名的文件.
如果此变量设置为 false
,则不会保留此文件.
默认为 true
(即保留备份文件).
另一种方法是不添加或忽略这些文件,如本 gitguru 文章、
<块引用>git mergetool
使用.orig
"后缀保存文件的合并冲突版本.
确保在添加和提交合并之前将其删除,或者将 *.orig
添加到您的 .gitignore
.
查找.-name *.orig寻找 .-name *.orig -delete
Charles Bailey 在 他的回答要注意内部差异工具设置,它也可以生成那些备份文件,无论是什么git设置是.
因此您还需要重置这些设置.
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 tofalse
then this file is not preserved.
Defaults totrue
(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屋!