Answer the question
In order to leave comments, you need to log in
How to add a folder higher in the directory to the git repository?
There is a WordPress site whose contents of the child-theme folder are in the github repository.
You need to include the folder of the dependent plugin in this repository (we donβt want to create a separate repository for the plugin!)
- public_html
-- wp-content
--- themes
---- child-theme
----- .git
--- plugins
---- my_plugin
- public_html
-- wp-content
--- themes
---- child-theme
--- plugins
---- my_plugin
-- .git
-- .gitignore
Answer the question
In order to leave comments, you need to log in
In general, you think correctly and the recipe will work. After moving the repository, git will say that you have moved all the theme files to a subfolder and will have to create a commit with this operation. But although you will see the old commit history, it will be difficult to use it, since the paths have changed.
It would be more correct to use the filter-repo command before moving the .git folder to rebuild all previous commits as if the repository was originally in the root.
Initial folder structure
public_html
βββ wp-content
βββ plugins
βΒ Β βββ my_plugin
βββ themes
βββ child-theme
βββ .git
git filter-repo --to-subdirectory-filter wp-content/themes/child-theme
public_html
βββ wp-content
βββ plugins
βΒ Β βββ my_plugin
βββ themes
βββ child-theme
βββ .git
βββ wp-content
βββ themes
βββ child-theme
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question