Change structure of project folder with Git
I have this structure:
project-folder/ .git wp-admin/ wp-content/ wp-includes/ .htaccess ...
I want this structure:
project-folder/ .git public wp-admin/ wp-content/ wp-includes/ .htaccess ...
- Keep away from the Internet my
- Wordpress files separated in a sub-folder
- Keep Git history changes
- Hide from the Internet deployment scripts or project sensitive informations
Move files with git and keep file history
Be sure you don't have files uncommitted, if not commit them before next step.
In project-directory create
Move files with
publicsubfolder to avoid errors
for file in $(ls | grep -v 'public'); do git mv $file public; done;
Move specific files like .htaccess etc...
git mv .htaccess public/
git commit -m 'Moved files to public/'
That's all !
git log -M summary
To see file history of moved files
git log --follow
On logging file(s) you have to check
[x] Follow renamed files