I’ve been making a WordPress theme and using git to save progress. My whole WordPress site is in the git project, and I would like to remove everything except the theme folder so I can easily transplant it on other WordPress sites.
I know one way is to just delete everything and move the theme to the root folder and commit. But checking out after that will be more complicated, right? So is there another way?
Thanks.
If you are interested in keeping the full history of your Theme folder, you can use
git filter-branch
and remove everything else.See “Extract part of a git repository?” ,to be done in a clone of your current repo: