How to discard unstaged changed in GIT?

Have you ever tried to discard changes in your working directory that are not staged yet?

How to discard unstaged changed in GIT?

image from dev.to

Have you ever tried to discard changes in your working directory that are not staged yet?

One way to do that is to use the following command:

git stash save --keep-index --include-untracked

If you don’t need to e thorough about it you can drop the --include-untracked argument.

Later on, if you wanted to remove that stash, you can use the git stash drop command to do so!

If you use GIT regularly, I recommend to get this book and have it on your desk:

Pro Git
Pro Git (Second Edition) is your fully-updated guide to Git and its usage in the modern world. Git has come a long way…www.amazon.com

If you liked this article, click the👏 below so other people will see it here on Medium.

Let’s be friends on Twitter. Happy Coding :)

Cheers!