Your custom theme or plugin is code, and it belongs in Git: every change recorded, easy to review, easy to undo. The WordPress site itself — core, uploads, the database — stays on the hosting; you keep just your own code in Belov Git and ship it to the site over SSH.
1
One repository per theme or plugin
Create a repository for the folder you actually write — wp-content/themes/your-theme or wp-content/plugins/your-plugin — not the whole site. Push it to Belov Git as described in Belov Git basics.
2
Set up SSH to the site once
On the site, open the SSH & SFTP tab and add your key; it shows a ready-made ~/.ssh/config entry for live and for staging. See SSH and WP-CLI for the details.
3
Ship to staging, then live
From your project folder, rsync it into the site. Try it on the staging copy first, then run the same command against live.
4
Tag what you released
Tag each release (git tag v1.4.0 && git push --tags), so going back is one command away.
From your theme's folder
git push # your code is safe in Belov Git
rsync -av --delete --exclude .git ./ my-site-staging:wp-content/themes/my-theme/ # try it on staging
rsync -av --delete --exclude .git ./ my-site:wp-content/themes/my-theme/ # then live
git checkout v1.3.0 && rsync -av --delete --exclude .git ./ my-site:wp-content/themes/my-theme/ # roll back
Careful with --delete
--delete makes the folder on the site match your repository exactly, removing files that aren't in Git. Point it only at your own theme or plugin folder — never at wp-content itself, which also holds uploads and other plugins.
Real SSH on every WordPress site — WP-CLI, rsync, VS Code Remote-SSH.