禁用Git重命名检测 [英] Disable Git Rename Detection
问题描述
- 我有一个文件,
foo.txt
- 创建并签出分支'branch_A'
-
git mv foo.txt bar.txt
后跟git add -A
然后git commit -m重命名为foo.txt
- 结帐主,
git checkout master $
- 删除foo.txt并提交。
- 现在合并branch_A,
git merge branch_A $ c
与此同时,我遇到了合并冲突(重命名/删除)。
CONFLICT(重命名/删除):重命名branch_A中的foo.txt-> bar.txt并删除HEAD
这是有道理的,也是我期望的。但是,我想知道是否有一种方法可以让git合并到不检测重命名,而是将它们视为已添加/删除。在这种情况下,我希望git检测到foo.txt被删除,并简单地添加bar.txt。没有冲突。
我尝试使用-X重命名阈值,但它没有为我工作。我已经尝试了阈值0和120(100以上的数字)。我错过了什么?
谢谢!
我还得到
错误:拒绝在......
错误中失去未跟踪的文件。这意味着什么?解决方案您可以试试:
git merge -s resolve 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
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.
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?
Thanks!
P.S. I'm also getting
error: refusing to lose untracked file at...
errors. What does this mean?解决方案Can you try with:
git merge -s resolve branch_A
Also, have you tried looking at similar questions here:
这篇关于禁用Git重命名检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!