Recently at work I had to split a sub-folder in a repository into its own repository. I wanted to keep the commit history. My search online led me to Splitting a subfolder out into a new repository on the GitHub Dos site.
The instructions there are very good. In a nutshell what I did was this.
git filter-repo --path FOLDER-NAME/command.
In all the process took about 5 minutes. Not something I’ll do every day, but it is nice to know it is possible.