How do you discard all changes from your local Git workspace?

Experience Level: Junior
Tags: GitSource control

Answer

To discard all changes from your local Git workspace, you can use the following commands:

  • git reset --hard - this will discard all changes permanently, discarded changes won't be preserved in any way
  • git stash - this will discard all changes, but will stash them away and you can restore them later using git stash pop command

Comments

No Comments Yet.
Be the first to tell us what you think.
Git for beginners
Git for beginners

Are you learning Git ? Try our test we designed to help you progress faster.

Test yourself
25 Git questions that will help you to nail your job interview
25 Git questions that will help you to nail your job interview

Are you learning Git ? Try our test we designed to help you progress faster.

Test yourself