Reputation: 566
I had a repo in one folder and I splitted this into submodules a while ago.
initial: (T0)
-mainpackage
\-subpackage1
\-subpackage2
current:(T1)
-subpackage1
-subpackage2
-mainpackage
Currently I can see all git history from the beginning. now I want to move this subpackage1 into another repo.
when I perform a surgery and filter the branch with git filter-branch --subdirectory-filter <directory of subpackage1> -- --all
I lose the history between T0 and T1 which is the most of the commits.
when I trace the history with git log --follow --pretty=format:"%H" <filename>
, i see same file had two versions latest ones with path to the file (like 'subpackage/src/../filename') and old commits with only file name (like 'filename').
How can I recover past history for the whole submodule (best case) or specific files (worst case - I am only interested in history of 4-5 files)
Upvotes: 0
Views: 652
Reputation: 913
You can solve your problem with git_filter_repo passing as parameter all paths in which the file(s) existed.
e.g.
git-filter-repo --path mainpackage/subpackage1 --path subpackage1
Upvotes: 1