You can run these two commands:
# Revert changes to modified files.
git reset --hard
# Remove all untracked files and directories.
# '-f' is force, '-d' is remove directories.
git clean -fd
More Related Contents:
- How do I revert a Git repository to a previous commit?
- How can I move HEAD back to a previous location? (Detached head) & Undo commits
- Undo git reset –hard with uncommitted files in the staging area
- Undo a particular commit in Git that’s been pushed to remote repos
- How do I use ‘git reset –hard HEAD’ to revert to a previous commit? [duplicate]
- What’s the difference between Git Revert, Checkout and Reset?
- Recover files that were added to the index but then removed by a git reset
- Remove sensitive files and their commits from Git history
- How can I undo git reset –hard HEAD~1?
- Reduce git repository size
- How do I resolve git saying “Commit your changes or stash them before you can merge”?
- Removing multiple files from a Git repo that have already been deleted from disk
- How can I revert multiple Git commits?
- Rollback to an old Git commit in a public repo
- Can I restore deleted files (undo a `git clean -fdx`)?
- How do I recover/resynchronise after someone pushes a rebase or a reset to a published branch?
- How to reference the initial commit?
- Skip Git commit hooks
- Unstaged changes left after git reset –hard
- How do I commit only some files?
- Why are there two ways to unstage a file in Git?
- How to fix committing to the wrong Git branch?
- What is the Sign Off feature in Git for?
- Removing multiple files from a Git repo that have already been deleted from disk
- Commit only part of a file’s changes in Git
- Why there are two ways to unstage a file in Git?
- git reset vs git reset HEAD
- What is difference between ‘git reset –hard HEAD~1’ and ‘git reset –soft HEAD~1’?
- Git checkout/pull doesn’t remove directories?
- How to see commits that were merged in to a merge commit?