Skip to content
Chapter 02 of 03 · 3 lessons · ~26 min

Undo, Branches and Merging

Undo mistakes without panic, experiment safely on branches and fix merge conflicts.

YOUR PROGRESS0%
/ Lessons in this chapter
04
How to Undo Changes in Git The safe way to undo almost anything in Git, from a typo to a bad commit. Coming soon
05
Git Branches for Beginners How to use branches to try ideas without risking the version that works. Coming soon
06
How to Merge Branches and Fix Merge Conflicts How to merge a branch into main and calmly resolve merge conflicts when they happen. Coming soon

Chapter practice task

Task: Build a new design on a branch, merge it and fix a conflict on purpose

  1. Make a mistake on purpose and undo it three different ways.
  2. Create a redesign branch and change the hero section there.
  3. Change the same line on main, then merge redesign to create a conflict.
  4. Resolve the conflict, commit and delete the branch.

By the end of this chapter

  • You can undo uncommitted and committed changes safely
  • You can create, switch and delete branches
  • Merge conflicts don’t scare you anymore

Quick answers for this chapter

Can Git lose my work?

Committed work is very hard to lose. Uncommitted changes can be lost with some commands, so commit often.

How many branches should I have?

One per feature or experiment. Delete them after merging.

Are merge conflicts bad?

No. They just mean Git needs a human to choose between two edits.