I have two files would like to send new repository of their own, but I also would like to keep their own history so the new repository already has some history.
I tried searching and I found these threads:
- Splitting a set of files within a git repo into their own repository, preserving relevant history
- How to split a git repository while preserving subdirectories?
- Create a submodule repository from a folder and keep its git commit history
But I could not figure out exactly how to write the command. I tried running this based on the above answers:
git clone repo
git remote rm origin
cd repo
git filter-branch --tree-filter 'git rm --cached --ignore-unmatch "filename1" "filename2"' -- --all
I was expecting to the current repository be cleaned and keep only with these two files and their history, then I could just push it as a new submodule, but after running the command all my files stayed in the repository.