Git - Reset all local changes

Git - Reset all local changes

My preferred way to reset a local git workspace to HEAD version. Untracked files and directories will be deleted too.

git add .
git reset --hard HEAD

The git reset --hard call doesn’t remove untracked files/directories. As a workaround you have to stage all changes and untracked files/directoy first. Then the clean out via git reset --hard resets all.


Florian Schmidt

Senior Java EE Software Engineer, Swift Enthusiast, Techie, Managing Partner Sneed IT UG, Founder Smipty