Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
584 views
in Technique[技术] by (71.8m points)

version control - Lost git history after reorganizing project folder

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...