Skip to content

How to use Git well

Small commits, frequent merges, clear messages, and rebase only local.

Git hygiene

  1. One concern per commit

    If the message has "and" twice, split the commit.

  2. Commit messages that survive `git log --oneline`

    Imperative subject ≤50 chars, blank line, wrapped body ≤72 chars explaining why.

  3. Rebase local, merge shared

    Rebase your local branch onto main before opening a PR. Merge feature branches with --no-ff to preserve the event.

  4. Never rebase main

    Rewriting main breaks every clone.

  5. Use `--force-with-lease`, never `--force`

    Protects against overwriting someone else's push.