Code of the Day
IntermediateGit in practice

Lab: handle git trouble

Pick the right recovery move — rebase, conflicts, revert vs reset, bisect.

Lab · optionalFundamentalsIntermediate10 min
By the end of this lesson you will be able to:
  • Choose between revert and reset by context
  • Recognise and handle a merge conflict
  • Reach for bisect to localise a regression

Optional scenario lab. Git trouble is calm when you know the move. Practice picking it — then try the commands in a scratch repo to make them muscle memory.

Scenarios: getting out of git trouble

  1. 1.
    You need to undo a commit that teammates have already pulled. Safest choice?
  2. 2.
    Mid-merge, a file now contains <<<<<<< HEAD and >>>>>>> markers. What are they?
  3. 3.
    Something worked last week and is broken now, somewhere in 200 commits. Best tool to find the culprit?
  4. 4.
    You want a clean, linear history on your own branch that you haven't pushed yet. Reasonable move?

Recovery is a skill, not a panic. You can now undo, resolve, and hunt regressions deliberately.

Finished reading? Mark it complete to track your progress.