重新组织项目文件夹后遗失了git历史记录 [英] Lost git history after reorganizing project folder
问题描述
我在一个月前做了一个提交,涉及到创建新的文件夹和子文件夹以及将它们之间的源代码文件移动。自从那时起,我第一次浏览我的历史,并且意识到git已经失去了历史,因为原始文件被删除,然后重新添加,我想 - 也就是说,当我在我的git GUI中查看文件时在NDA之下,所以我不能直接讨论它,但是例如,这个仓库在GitHub上也被打破了,GitHub清楚地显示它将检测提交作为一系列动作)。它只显示每个文件的历史记录,当项目文件夹被重新组织。
在阅读了几个问题之后(获取Git来确认以前移动的文件,如何将git标记删除,并将新文件作为文件移动?),我只是比开始时丢失更多。这听起来像是从那些答案中我根本无法解决这个问题?我非常感谢这里的任何帮助。
在Git中没有文件移动的概念。
$ b
有些工具,比如GitHub,会考虑一个提交,其中包含一个名为X的文件,该文件已被删除,一个名为X的文件已被创建为文件移动。
根据Linus Torvalds的说法,文件移动只是重构的一个特例;出于这个原因,Git不会以不同的方式对待它。处理这种特殊情况与其他许多情况一样,由高级工具(例如前端)处理。
有关此主题的更多信息,请查看来自Linus Torvalds的这个回答。
I made a commit about a month ago that involved me creating new folder and sub-folders and moving my source code files in between them. I just was looking through my history for the first time since then and realized git has 'lost' history since the original files were deleted and then re-added, I suppose - i.e. when I'm viewing a file in my git GUI (it's under NDA so I can't discuss it directly, but for example, this repository is broken on GitHub too. GitHub clearly shows its detecting the commit as a series of moves.) it only shows history for each file back to when the project folder was reorganized.
After reading a few questions ( Getting Git to Acknowledge Previously Moved Files, How to make git mark a deleted and a new file as a file move?), I'm simply more lost than when I started. It sounds like from those answers that I won't be able to fix this at all? I'd really appreciate any help here.
In Git there's no the concept of file move.
Some tools, like GitHub, consider a commit containing a file named X that has been deleted and a file named X that has been created a file move.
According to Linus Torvalds, file move is just a special case of refactoring; for this reason Git will not treat it differently. Handling of this special case, like many others, is left to higher-level tools (such as frontends).
For more info on this topic, check this answer from Linus Torvalds.
这篇关于重新组织项目文件夹后遗失了git历史记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!