Lesson 28 / 28
Git Flow vs Trunk-Based
Compare Git Flow and trunk-based development and choose a branching strategy for your team.
Git Flow
Git Flow uses long-lived develop and main branches plus dedicated feature/, release/, and hotfix/ branches. Structured, but heavier for fast-moving teams.
Trunk-based development
Everyone commits small, frequent changes directly to (or via very short branches into) a single main trunk, often behind feature flags — favored for continuous delivery.
Quick check: Which strategy favors small, frequent commits straight into one trunk?
- Git Flow
- Both equally
- Trunk-based development
- Neither
Answer
Trunk-based development — Trunk-based development minimizes long-lived branches in favor of continuous integration into main.
Final quiz 1 of 8
Final quiz
Quick check: What does git add do?
- Uploads to GitHub
- Deletes files
- Stages changes for the next commit
- Creates a branch
Answer
Stages changes for the next commit — Staging selects what goes into the next commit.
Final quiz 2 of 8
Final quiz
Quick check: Which command creates and switches to a new branch?
- git branch -d name
- git merge name
- git init name
- git switch -c name
Answer
git switch -c name — -c creates the branch.
Final quiz 3 of 8
Final quiz
Quick check: When does a merge conflict happen?
- Two branches change the same lines differently
- A branch is renamed
- The remote is offline
- You forget git status
Answer
Two branches change the same lines differently — Git cannot choose between competing edits.
Final quiz 4 of 8
Final quiz
Quick check: Which command safely undoes a pushed commit?
- git reset --hard
- git revert
- git rebase -i
- git stash
Answer
git revert — revert adds a new commit that cancels the old one.
Final quiz 5 of 8
Final quiz
Quick check: Which reset mode discards working changes?
- --soft
- --mixed
- --hard
- --keep-history
Answer
--hard — --hard resets index and working tree.
Final quiz 6 of 8
Final quiz
Quick check: Why avoid rebasing shared branches?
- It is slow
- It deletes tags
- It needs admin rights
- It rewrites history others already pulled
Answer
It rewrites history others already pulled — Rewritten commits diverge from teammates' copies.
Final quiz 7 of 8
Final quiz
Quick check: What does git stash do?
- Shelves uncommitted changes temporarily
- Deletes the repo
- Pushes to remote
- Renames a branch
Answer
Shelves uncommitted changes temporarily — pop or apply brings them back.
Final quiz 8 of 8
Final quiz
Quick check: Which command finds the commit that introduced a bug?
- git cherry-pick
- git bisect
- git remote
- git config
Answer
git bisect — bisect binary-searches history between good and bad commits.