All cheat sheets

Tooling

Git cheat sheet

Everyday Git commands plus the recovery moves that matter when something goes wrong: reflog, restore, revert and safe force-pushing.

Branching

Staging

History

Recovery

Remote

Things worth remembering

  • git reflog remembers where HEAD has been for about 90 days, so almost nothing is truly lost.
  • Use --force-with-lease instead of --force so you never overwrite a teammate push.
  • git revert makes a new commit and is safe on shared branches. git reset rewrites history and is not.

More Tooling sheets