Leave only a specific directory in git history
Sometimes you want to limit the history of a git repository to only a specific sub-directory. git filter-branch
to the rescue!
Try something like that:
git filter-branch --subdirectory-filter sub/directory -- --all
Note this might not end well, as indicated by the huge warning. Also, you might want to prune your reflog and do a git gc
afterwards, especially if the original repository is huge.