Search⌘ K
AI Features

Recover Your Repository

Explore how to recover your Git repository using git reset commands. Understand the differences between --mixed and --hard flags to undo mistakes, restore deleted files, and manage changes. This lesson helps you gain practical knowledge on safely reverting repository states and handling staged files.

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 ...