The following steps can be followed for filtering a set of folders found in a git repository. It would preseve the given folders and their commits and remove everything else from the repository. This would be useful for moving a collection of folders from one git repository to another with their commit history.
-
Take a copy of the source git repository
cp -r [source-repository-folder] source-repository-copy