Deploying with Git: A Beginner's Workflow for Shared Hosting

FTP uploads are how sites get broken at 2 AM. Git gives you version history, easy rollbacks, and sane deployments — even on shared hosting.
The simple workflow
- Develop locally, commit often with clear messages.
- Push to a repository (GitHub, GitLab).
- On the server,
git pullin your site directory — or use a deploy key with webhooks for automatic pulls.
What about databases?
Git does not version databases. Keep a migrations folder with SQL files, applied in order. Document the current schema version somewhere obvious.
Rollbacks
Deployed something broken? git revert or checkout the previous tag, pull, done. Compare that to re-uploading files from memory at midnight.
Keep secrets out
Never commit .env files, API keys, or passwords. Use .gitignore aggressively and environment variables on the server.


