Chapter 49: Git CI/CD
Git + CI/CD (Continuous Integration / Continuous Delivery / Continuous Deployment — the automation layer that sits on top of Git)
This is not a Git command. Git itself has no built-in CI/CD.
CI/CD is the ecosystem that lives around Git repositories — mostly on platforms like GitHub, GitLab, Bitbucket, Azure DevOps, Jenkins, CircleCI, etc.
In 2026 almost every serious team uses CI/CD — even solo developers use it for personal projects. If you push code without CI/CD in a job interview in 2026, many interviewers will quietly think: “this person is still living in 2018”.
So let’s understand it properly — slowly, like I’m sitting next to you setting up your first real pipeline.
1. What do the letters actually mean? (plain English 2026 version)
| Term | Full name | What it really means in daily life (2026) |
|---|---|---|
| CI | Continuous Integration | Every time someone pushes code → automatically run tests, linting, build → give fast feedback (“green” or “red”) |
| CD (two meanings) | Continuous Delivery | The pipeline can automatically prepare a release artifact (Docker image, APK, website build…) that is ready to be manually deployed |
| CD (second meaning) | Continuous Deployment | The pipeline automatically deploys to production/staging every time tests pass (no human approval needed) |
Most teams in 2026 aim for Continuous Deployment (full automation), but many still have Continuous Delivery with manual approval gates for production.
2. Where does Git fit in?
Git is the source of truth — every change lives in commits on branches.
CI/CD platforms watch your Git repository (usually via webhooks):
- Someone pushes to main / creates PR / pushes to feature branch
- Platform receives webhook → starts pipeline
- Pipeline clones your repo → runs steps you defined
Most popular CI/CD platforms tightly integrated with Git in 2026:
| Platform | Best known for | Free tier (2026) | Most loved by… |
|---|---|---|---|
| GitHub Actions | Native to GitHub, YAML-based, huge marketplace | 2,000 minutes/month free (private repos) | Almost everyone using GitHub |
| GitLab CI/CD | Built-in pipelines, very powerful free tier | Very generous free minutes | Teams using GitLab or self-hosted |
| CircleCI | Very fast, great UI | Free plan still decent | Startups, speed lovers |
| Jenkins | Extremely customizable, plugins for everything | Free (but you host it) | Enterprise, legacy teams |
| Azure Pipelines | Microsoft ecosystem | 1,800 minutes/month free | .NET / Azure users |
3. Realistic Example – Your First GitHub Actions CI/CD Pipeline
We will create a tiny Node.js todo app → add tests → set up GitHub Actions to automatically test every push & PR.
Step 1 – Create simple project
|
0 1 2 3 4 5 6 7 8 9 |
mkdir todo-ci-cd-demo cd todo-ci-cd-demo npm init -y npm install jest --save-dev |
Create index.js:
|
0 1 2 3 4 5 6 7 8 9 10 |
function addTodo(todos, task) { return [...todos, task]; } module.exports = { addTodo }; |
Create index.test.js:
|
0 1 2 3 4 5 6 7 8 9 10 11 12 |
const { addTodo } = require('./index'); test('adds a todo', () => { const todos = ['Buy milk']; const newTodos = addTodo(todos, 'Call mom'); expect(newTodos).toEqual(['Buy milk', 'Call mom']); }); |
Step 2 – Add test script to package.json
|
0 1 2 3 4 5 6 7 8 |
"scripts": { "test": "jest" } |
Test locally:
|
0 1 2 3 4 5 6 7 |
npm test # PASS index.test.js |
Step 3 – Push to GitHub
Create repo on GitHub → push code
|
0 1 2 3 4 5 6 7 8 9 10 11 |
git init git add . git commit -m "Initial todo app with Jest test" git remote add origin https://github.com/your-username/todo-ci-cd-demo.git git branch -M main git push -u origin main |
Step 4 – Create .github/workflows/ci.yml
Create folder .github/workflows/ → file ci.yml:
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
name: CI Pipeline on: push: branches: [ main ] pull_request: branches: [ main ] jobs: test: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: '20' - name: Install dependencies run: npm ci - name: Run tests run: npm test |
Commit & push:
|
0 1 2 3 4 5 6 7 8 |
git add .github/workflows/ci.yml git commit -m "ci: add GitHub Actions workflow for Jest tests" git push |
Step 5 – Watch it run
Go to your repo on GitHub → Actions tab → You see workflow running → green checkmark if tests pass
Now every push and every PR automatically runs your tests — no human needs to remember.
4. Real-World GitHub Actions Examples (2026 patterns)
Pattern 1 – Build & deploy static site (GitHub Pages)
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 |
- name: Build run: npm run build - name: Deploy to GitHub Pages uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./build |
Pattern 2 – Run tests + lint + security scan
|
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: npm ci - run: npm run lint test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: npm ci - run: npm test security: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: npm audit --audit-level=high |
Pattern 3 – Deploy to Vercel / Netlify on push to main
|
0 1 2 3 4 5 6 7 8 9 10 11 |
- name: Deploy to Vercel uses: amondnet/vercel-action@v25 with: vercel-token: ${{ secrets.VERCEL_TOKEN }} vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} |
5. Quick CI/CD Cheat Sheet (2026)
| Task | Typical 2026 command / pattern | Platform |
|---|---|---|
| Run tests on every push/PR | GitHub Actions + npm test / pytest | GitHub Actions |
| Build & deploy static site | npm run build → gh-pages / Vercel action | GitHub Actions / Vercel |
| Lint + format check | npm run lint / prettier –check | GitHub Actions |
| Security scan | npm audit / snyk test / Dependabot | GitHub / Snyk |
| Deploy to production | Vercel / Netlify / Render / Railway auto-deploy | GitHub Actions + webhook |
| Manual approval gate before prod | environment: production + required reviewers | GitHub Actions |
Got the Git + CI/CD feeling now?
Git + CI/CD = “every push / PR automatically runs tests, builds, scans, and often deploys — so humans only review, not manually test”
It turns Git from “version history tool” into the central nervous system of modern development.
Next?
- Want to create your first real GitHub Actions workflow together?
- See how to add tests + CI to an existing project?
- Or do one final big summary of all Git concepts we covered today?
Just tell me — we’ll finish strong. You’ve now gone from zero to very advanced Git + modern workflows — truly impressive! 🚀
