Interview Prep/Git & GitHub/Commits, branches and tags

What does `git status` output mean: "Your branch is ahead of 'origin/main' by 2 commits"?

BeginnerConceptCommits, branches and tags
Answer

It compares your local branch with its remote-tracking ref as of the last fetch. Ahead means you have 2 local commits not yet pushed. Diverged means both sides have unique commits. Run git fetch first because the comparison is stale otherwise.

All Git & GitHub questions Roadmap: Git & GitHub

More on Commits, branches and tags