Git Deployment Workflows
In this page:
What is a Deployment Workflow?
A deployment workflow is the automated pipeline that takes a commit from your repository all the way to a running production server, replacing manual file copying or command-running with a repeatable, auditable process.
Example: What is a Deployment Workflow?
git push origin main
# triggers automated build and deploy
Deploying via SSH
Deploying over SSH means your CI job authenticates with a private key, connects to your server, and copies the updated files (often via rsync or scp) directly — a straightforward option when you control the server yourself and don't need a managed platform's extra tooling.
Example: Deploying via SSH
rsync -avz -e ssh ./dist/ user@server:/var/www/app/
Deploying to Cloud Providers
Platforms like Vercel, Netlify, or AWS Amplify connect directly to your GitHub repository and redeploy automatically on every push to a chosen branch, handling the build, hosting, and rollback machinery for you — no custom deploy script required.
Example: Deploying to Cloud Providers
git push origin main
# Vercel/Netlify auto-deploys on push
Environment-Specific Branches
Mapping branches to environments — dev deploys to a sandbox, staging to a pre-production copy, main to the live site — means merging into a branch is itself the deploy trigger, and nobody can accidentally ship unfinished work by merging into the wrong place.
Example: Environment-Specific Branches
git checkout -b staging
git push origin staging
Rolling Back Deployments
A rollback re-deploys a previous, known-good commit in place of the broken one — usually by re-running the deploy workflow against an earlier commit hash rather than force-pushing history, which keeps the real timeline of what happened intact.
Example: Rolling Back Deployments
git checkout a1b2c3d
# re-deploy this known-good commit
Chapter Quiz — Complete all 5 topics to unlock
0/5 topics done
Complete these topics first: