C.W.K.
Stream
Lesson 07 of 12 · published

Git as the Foundation

~12 min · git, events, branches

Level 0Apprentice
0 XP0/101 lessons0/10 achievements
0/120 XP to next level120 XP to go0% complete

Pipelines react to Git events

Every CI/CD system is, underneath the marketing, an event listener for Git. A push, a tag, a pull request — these are the triggers that fire workflows. If you understand Git well, you understand half of CI/CD already.

The events that matter on GitHub:

  • push — to any branch, or filtered to specific branches.
  • pull_request — opened, synchronized (new commit pushed), reopened, ready_for_review.
  • tag push — usually for release pipelines (push a v1.2.3 tag → trigger release workflow).
  • schedule — cron-like, for nightly builds and dependency scans.
  • workflow_dispatch — manual trigger from the UI or API.
  • repository_dispatch — external system pings the repo.

Branching strategies and CI shape

Two common branching strategies have very different CI implications:

  • Trunk-based — short-lived feature branches, merged daily. CI runs on every PR and every push to main. Smooth, fast, requires discipline.
  • Git Flow — long-lived develop, release, hotfix branches. CI is more complex (different gates per branch class). Slower, more ceremony, useful for slow release cadences (regulated industries, packaged software).

Pick the strategy first; the CI structure follows.

Code

Different triggers per workflow·yaml
# .github/workflows/pr.yml — runs on PRs only
name: pr-checks
on:
  pull_request:
    types: [opened, synchronize, reopened]

# .github/workflows/release.yml — runs on tag pushes
name: release
on:
  push:
    tags: ['v*.*.*']

# .github/workflows/nightly.yml — runs at 06:00 UTC daily
name: nightly
on:
  schedule:
    - cron: '0 6 * * *'
  workflow_dispatch: {}

External links

Exercise

List every workflow file in your repo (or pick a public repo if you don't have one). For each, write down which Git event triggers it, on which branches/tags, and what category of work it does (lint? test? release? schedule?). Spot any duplicates.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.