← back to flaviocopes.com

Git recovery

← All tools

Git mistakes are common. This decision tree asks what happened, whether you pushed, and whether you need to keep changes — then gives step-by-step commands with a danger level for each path.

~~~
~~~

About this tool

This is not a substitute for reading git helpon your exact situation — it covers the "oh no" moments that come up repeatedly: wrong branch, unpushed amend, deleted branch, merge abort, secrets in history.

Pushed commits on shared branches should almost always be fixed with git revert, not reset --hard plus force push. The tree calls that out on every relevant path.

~~~

Read more