Scenarios · Git · GS1.1 · 8 min · L0

Oops, I committed on main

Two good commits. One wrong branch.

✓ Validated on Git 2.43.0 · Run 1 · 2026-11-21Preview

The story

You joined the Showdown team yesterday: Lakshmi runs the API, Ravi builds the frontend. The team has one rule. Every change goes through a pull request. This morning you rename the app to "The Showdown" and bump the version to 1.1.0, two neat commits. Then you look at your prompt. It says main. Nothing is pushed yet, and Lakshmi's review is at noon.

1 · Predict first

Your two commits are on main and not pushed. Is any of the team's work in danger?
What has to change to put things right?

Where you will meet this at work

  • Branch protection on GitHub or GitLab rejects a direct push to main, so you find out at push time. Fixing it before you push is quieter.
  • A shell prompt that shows the current branch (most shell themes, or git's own git-prompt.sh) catches this before the first commit.
  • Started work on the wrong feature branch? The same two moves apply: a new name for your commits, and the old branch moved back.

Keep going