Explore Courses Blog Tutorials Interview Questions
+1 vote
in DevOps and Agile by (19.4k points)

How can I undo every change made to my directory after the last commit, including deleting added files, resetting modified files, and adding back deleted files?

1 Answer

0 votes
by (27.5k points)

Step 1: Reset the changes with the help of following command:

$ git reset HEAD --hard

Step 2: Clean out everything untracked. In case you want to keep files that are not tracked due to .gitignore, be careful with this command.

$ git clean -fd

Browse Categories