Switch to the main branch.
git checkout main
git checkout main updates HEAD and the working tree to the named branch. Use git switch main (Git 2.23+) for the safer modern equivalent that won't accidentally detach HEAD.
Safety: Inspect first and avoid rewriting shared history unless the team expects it.
Switch to main and immediately sync with the remote - the standard start-of-work combo.
git checkout main && git pull origin main
Chains the branch switch with a remote sync so you start from latest main. The && ensures the pull only runs if checkout succeeds - important if main has uncommitted blockers.
Safety: Inspect first and avoid rewriting shared history unless the team expects it.
Build the habit: GitDrill drills git checkout and the rest of the Git workflow until the safe first move is automatic. Try a Git drill.