Cheatsheet Pages / Git Cheatsheet

How to undo a pushed commit safely — git revert

A commit that is already pushed and shared turns out to be wrong and must be undone safely.

git revert <commit-sha>   # safe undo; use this instead of reset on pushed work

Good to know

Creates a new commit that undoes an old one — safe for shared branches, unlike reset.

Git Cheatsheet one-page card — 30 daily and rescue commands
The full one-page card — Git Cheatsheet. Get the complete cheatsheet on GitHub