Quantcast
Viewing latest article 40
Browse Latest Browse All 42

Answer by Cary for How do I discard unstaged changes in Git?

To delete unstaged changes I tried "git restore ." as I was told by Git but it just didn't work. A very good way is to use:

git revert --hard

It works perfectly. Its Git Help explains perfectly the point:

--hardResets the index and working tree. Any changes to tracked files in the working tree since are discarded. Any untracked files or directories in the way of writing any tracked files are simply deleted.

PS: I am using git version 2.35.3.windows.1. I think quite some answers here made the issue over-complicated.


Viewing latest article 40
Browse Latest Browse All 42

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>