禁用 Git 重命名检测 [英] Disable Git Rename Detection

查看:27
本文介绍了禁用 Git 重命名检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  1. 我有一个文件,foo.txt
  2. 创建并结帐分支branch_A"
  3. git mv foo.txt bar.txt 然后是 git add -A 然后 git commit -m "renamed foo.txt"
  4. 结帐大师,git checkout master
  5. 删除 foo.txt 并提交.
  6. 现在合并 branch_A,git merge branch_A
  1. I have a file, foo.txt
  2. Create and checkout branch 'branch_A'
  3. git mv foo.txt bar.txt followed by git add -A then git commit -m "renamed foo.txt"
  4. Checkout master, git checkout master
  5. remove foo.txt and commit.
  6. 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 重命名/删除混淆

git divergent 重命名

这篇关于禁用 Git 重命名检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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