Just wondering what the general preference is if you git init on the whole project or just the theme?
Typically with other CMS’s I would do the whole thing but with wordpress and Roots, just the theme makes more sense…kinda…but then plugins and such arent included so I’m a bit lost for how best to approach it tbh.
Typically my workflow with git would involve working locally on a development branch with the whole CMS (when it isnt roots / wordpress) then push to a staging site for review (SSH into staging site and git pull origin develop) then when its ready for live pretty much do the same thing but merge to master locally, run production / minification script in terminal, commit, push to live.
And also while doing the above, exporting database locally and then importing to live / development site.
I was looking into Bedrock but unfortunately only found out about it too late and all projects I have started with Sage are only using sage…is it possible to migrate easily or would I essentially have to start again and re-build the sites?
The rebuild I imagine would be easy enough as I assume I would just be copy / pasting code into the new file structure but it would be time consuming…
You install Bedrock, configure your webserver to point to /web as the public path (e.g. /home/user/public_html/web), configure .env as you would wp-config.php, copy your existing theme, plugins, and uploads into web/app/X instead of wp-content/X – as far as getting it into the new file structure, you’re good to go.
Only remaining step would be converting wp-content/uploads to app/uploads within’ your database. This can easily be achieved using WP-CLI:
# Backup your database.
$ wp db export db.sql
# Run search-replace as a dry run initially.
$ wp search-replace wp-content/uploads app/uploads --dry-run
# Run search-replace.
$ wp search-replace wp-content/uploads app/uploads
Additionally, not to lose all images SEO, I think it’s important to have 301 redirects for all wp-content related stuff to app. Sth like this in your .htaccess if you are using Apache.
Hey…so I have done this but git was initialised within the theme folder that I copied over before i moved it. Now when I run git init on the bedrock root folder it gives me an error “warning: adding embedded git repository”.
Normally I would find the .git folder and delete it to solve this problem but there is no .git folder and I’m thinking roots does some wierd magic to hide it away? How do I get rid of the repository inside the repository?