Recover Your Repository

See how to effortlessly recover the previous state of a Git repository.

The git reset command

You can use git reset to recover the state of the Git repository in various ways.

By default, Git will recover whatever has been added to the index/staging area and place it in your working directory.

By contrast, a git reset --hard will blitz all local and added changes, reverting your checkout to a just-cloned and committed state.

Back to our friend git status:

1	git status

What does this tell you about the state you’re in?

Get hands-on with 1200+ tech skills courses.