禁用 Git 重命名检测 [英] Disable Git Rename Detection
问题描述
- 我有一个文件,
foo.txt
- 创建并结帐分支branch_A"
git mv foo.txt bar.txt
然后是git add -A
然后git commit -m "renamed foo.txt"
- 结帐大师,
git checkout master
- 删除 foo.txt 并提交.
- 现在合并 branch_A,
git merge branch_A
- I have a file,
foo.txt
- Create and checkout branch 'branch_A'
git mv foo.txt bar.txt
followed bygit add -A
thengit commit -m "renamed foo.txt"
- Checkout master,
git checkout master
- remove foo.txt and commit.
- Now merge branch_A,
git merge branch_A
因此,我遇到了合并冲突(重命名/删除).
And with this, I get an merge conflict (rename/delete).
CONFLICT (rename/delete): Rename foo.txt->bar.txt in branch_A and deleted in HEAD
这是有道理的,也是我所期望的.但是,我想知道是否有一种 git merge 方法可以不检测重命名,而是将它们视为已添加/已删除.在这种情况下,我希望 git 检测到 foo.txt 被删除并简单地添加 bar.txt.没有冲突.
This makes sense and is what I'd expect. However, I'd like to know if there is a way for git merge to not detect renames, but instead treat them as added/deleted. In this case, I'd expect git to detect that foo.txt was deleted and simply add bar.txt. No conflict.
我试过使用 -X rename-threshold,但它对我不起作用.我试过阈值 0 和 120(大于 100 的数字).我错过了什么?
I've tried using -X rename-threshold, but it has not worked for me. I've tried thresholds 0 and 120 (a number above 100). What am I missing?
谢谢!
附言我也收到 error: refining to lost untracked file at...
错误.这是什么意思?
P.S. I'm also getting error: refusing to lose untracked file at...
errors. What does this mean?
推荐答案
你可以试试:
git merge -s resolve branch_A
此外,您是否尝试在此处查看类似问题:
Also, have you tried looking at similar questions here:
这篇关于禁用 Git 重命名检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!