# git revert — Git

Source: https://www.geekswithgeeks.com/en/git/git-revert

> Undo a commit safely by adding a new, opposite commit.

## Undo without rewriting history

`revert` creates a **new commit** that undoes an earlier one — the original commit still exists in history.

```bash
git revert a1b2c3d
```

Output:

```
[main 4d5e6f7] Revert "Add experimental cache"
```

## revert vs reset

Use `revert` on commits **already pushed and shared** — it's safe for everyone. Use `reset` only on local, unpushed commits.
