Reputation: 557
I have restructured my project folders. I see that i lost commit history before restructuring of files in my remote repository.
I have the history before restructuring locally. Right now everyone who clone the repository doesn't have the commit history before restructuring. Is there anyway i can rebuild the commit history and merge it to the remote repository?
When i try this command :
git log --follow pom.xml
I can see full history of file, but when i dont use --follow the log stops at restructuring commit.I would like that it shows all the history. Is there any way to fix this?
Upvotes: 0
Views: 170
Reputation: 487993
The only way to lose history in Git is to remove commits. This is because the commits are the history. There is no file history; there are only commits.
When you use git log --follow pom.xml
, you are telling Git to synthesize a file history, by wandering through the commit history and noting when a file named pom.xml
is touched. The --follow
option tells Git that in addition to checking to see if pom.xml
is changed in that commit, it should also check to see if it is renamed in that commit. If so, Git checks earlier commits for the old name (including its full directory path) instead of the new name—so Git is no longer looking for new/pom.xml
but now looking for old/pom.xml
or whatever, and constructing a file history for that file.
If you use an IDE, the IDE must do the same thing as Git—synthesize a file history by selecting commits that change that file, and check for rename operations in the process, if that's what you want it to do.
Upvotes: 1
Reputation: 557
Finally i found out thats an issue only on Bitbucket and Eclipse. Bitbucket shows all commits to the repository but can not show the sinbgle file log with the command --follow. The same issue is with Eclipse. Intellij works fine.
Upvotes: 0