合并时不要让git重命名文件 [英] Don't let git rename files during merge

查看:112
本文介绍了合并时不要让git重命名文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将分支"a"合并为分支"b".我在每个分支中都有相同的文件,唯一的区别是文件名.当我将"a"合并为"b"时,"a"的文件名会覆盖"b",有没有办法阻止这种情况?

I'm trying to merge branch 'a' into branch 'b'. I have files that are the same in each branch, where the only difference is the filenames. When I merge 'a' into 'b', the filenames for 'a' overwrite 'b', is there a way to stop this?

这些文件也位于目录中,如果可以防止在该目录中重命名任何文件,那将是很好的选择.

These files are also in a directory, it would be good if I could prevent any file being renamed in that directory.

或者,是否有一种方法可以在合并后恢复旧文件名?

Or alternatively, is there a way to restore the old filenames after the merge?

推荐答案

似乎是:

git merge -X --no-renames a

git merge -X --no-renames a

有了这个技巧,多亏了irc.freenode.net上#git上的人

Did the trick, thanks to the people on #git on irc.freenode.net

这篇关于合并时不要让git重命名文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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