Question

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.

Was it helpful?

Solution

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:

git filter-branch --subdirectory-filter Project/SubProject-0 --prune-empty -- --all
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top