让Git确认以前移动的文件 [英] Getting Git to Acknowledge Previously Moved Files

查看:95
本文介绍了让Git确认以前移动的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我手动移动了一堆文件而没有想到,也找不到一种让git识别文件刚刚移动而不是实际上不同文件的方法。有没有办法做到这一点,除了删除旧的和添加新的(并因此失去了历史),或重新使用git-mv的所有更改?

解决方案

我认为它已经做到了。现在,我可能是错的,但是我已经根据它们的内容读取了这些git跟踪文件,而不是基于它们在文件系统中的位置或基于差异/差异。在堆栈中,我认为它显示它好像文件正在被删除,然后重新添加,但我认为我已经尝试过一次,它仍然保留了历史记录,这是由于上述git跟踪事物的方式。 p>

仍然有助于某人验证我是否正确。对不起,如果我误解了你的问题。


I've moved a bunch of files around manually without thinking, and can't find a way to get git to recognize that the files are just moved and not actually different files. Is there a way to do this other than removing old and adding the new (and thus losing the history), or redoing all the changes with git-mv?

解决方案

I think it already does this. Now, I could be wrong, but I've read that git tracks files based on their contents not based on their position in the file system or based on delta/differences. In the stack I think it shows it as if the files are being removed and the then re-added, but I think I've tried this once and it still maintained the history, due to the aforementioned way that git tracks things.

Still would be helpful for someone to verify if I'm correct or not. Sorry if I misunderstood your question.

这篇关于让Git确认以前移动的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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