Sikau

Git & GitHub · Day 12 · about 35 min

Project: Feature branch workflow

Branch, build, merge, tidy — like a team.

How teams really work

Professional teams never commit straight to main. Every change lives on its own short branch until it's ready. Run a full cycle — including a conflict — on your own.

The feature branch workflow

This is the workflow used in most professional teams worldwide.

Teams keep main always working and always ready to release. Every change — a feature, a fix, a typo — happens on its own short-lived branch, named after what it does. When it's finished, it's merged into main and the branch is deleted. Because each branch is small and lives only hours or days, merges are easy and conflicts stay small.

git switch -c specials
# edit, commit…
git switch main
git merge specials
git branch -d specials

git switch -c rename
# edit, commit…
git switch main
git merge rename      # conflict? resolve, add, commit
git branch -d rename

The longer a branch lives, the more main moves underneath it and the bigger the eventual merge. That's why experienced developers merge (or update their branch from main) often, rather than saving everything for one giant merge at the end.

The rest of this lesson

  • Handling interruptionsexplain
  • One feature cycleorder
  • Urgent fixpredict
  • Situation → toolmatch
  • Ship two featureschallenge
  • Badge quizquiz
  • Unit 2 complete!recap

Continue this lesson free — run real code in your browser

Continue with Google

See all 18 lessons of Git & GitHub