I made a lot of unhelpful changes, and would like to revert to the state my repo was in before any of the changes.
Is there a git command for doing that?
Thanks!
I made a lot of unhelpful changes, and would like to revert to the state my repo was in before any of the changes.
Is there a git command for doing that?
Thanks!
Copyright © 2021 Jogjafile Inc.
First, to revert changes to tracked files:
git resetalone resets the index; adding--hardresets the working copy as well. If you've already committed, specify a different commit to reset to - eg,HEAD^to revert to the parent commit ofHEAD(ie, to remove the latest commit).Next, to delete all untracked files:
-dtells it to delete directories,-fforces it to actually do the delete, and-xskips.gitignored files.