← Back to Git Course | Chapter 9: CI/CD & DevOps | Lesson 4 of 5

Git Deployment Workflows

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?

bash
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

bash
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

bash
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

bash
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

bash
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:

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.