You will practice short-lived feature branches and compare merge versus rebase to keep history readable. By the end you will choose a branching workflow that keeps main always releasable.

Learning Objectives

  • Compare GitHub Flow, trunk-based, and GitFlow trade-offs.
  • Integrate work with merge and with rebase.
  • Keep main releasable with short-lived branches.
  • Time: ~3 hours · Difficulty: Intermediate · Prereqs: the Git fundamentals lab.

Architecture Overview

Environment Setup

You will need: Git and a repo with a couple of branches.

Before you begin: never rebase commits that others have already pulled.

Step-by-Step Execution

01
Create a short-lived feature branch
git switch -c feature/api && git commit -am "add endpoint"
02
Integrate with merge (preserves history)
git switch main && git merge --no-ff feature/api
03
Or rebase for a linear history
$ git switch feature/api && git rebase main
Successfully rebased and updated refs/heads/feature/api.

Progress So Far

Testing & Validation

git log --oneline --graph --all

A merge shows a branch-and-join graph; a rebase shows a straight line. Pick the one your team prefers and keep main green.

Troubleshooting
  • Rebase rewrote shared history: only rebase local, un-pushed work; otherwise merge.
  • Long-lived branches diverge: keep branches short to avoid painful integrations.
  • Mid-rebase confusion: abort safely with git rebase --abort.

Extension Ideas

Key Results

  • Integrated a feature with both merge and rebase.
  • Produced a readable history matching the chosen strategy.
  • Kept main releasable with short-lived branches.
  • Understood when rebase is safe versus dangerous.