Getting code from your machine to the server reliably.
THE BASIC FLOW
- Develop locally.
- Commit and push to your remote repository.
- On the server, pull the changes.
- Run any post-deployment steps: dependency install, migrations, cache clear.
- Verify the site works.
WHY NOT EDIT ON THE SERVER
Changes made directly on the server exist nowhere else, are lost at the next deployment, and cause regressions nobody can explain.
If you must fix something urgently on the server, commit the same change to the repository immediately afterwards.
SCRIPTING IT
Write a short script performing the pull and the post-deployment steps. Run one command rather than remembering five.
Keep the script in the repository.
WHAT TO AUTOMATE LATER
Triggering deployment from a push, using a webhook or a pipeline. Worth it once manual deployment becomes the bottleneck, not before.
CONFIGURATION
Keep environment-specific configuration out of the repository. The server holds its own .env or config file, excluded from Git.