How to reject all changes in Git?

If you want to reject all changes in your local git repository you must:

  1. Discard local changes
  2. Remove untracked files

To discard all local changes run:

git reset --hard

To remove untracked files run:

git clean -df

After executing these two commands you will have no changes whatsoever. If you run git status you should receive:

“nothing to commit, working tree clean”

Leave a Reply

Your email address will not be published. Required fields are marked *