Another thing I used to think was impossible: backing up a WordPress site via Git.
This guide assumes you have set up your WordPress directory as a Git repo. It will only tell you the console commands required to create a backup.
cd /var/www/html/sitename/public_html
git add .
to add all new files since the last update. You’ll see a lot of lines like this, which are all the new files being added:git commit -m "Message"
Message
to describe the update, something like “Uploading new style sheets”git push
It took me a while to get my head around this because I thought ‘git commit’ would upload the files, but you actually need the extra step of ‘git push’.
There you go!