Q) How do I revert all local changes in Git managed project to previous state?


First, backup your local work on a seperate branch in case this goes wrong, this is a destructive operation

Let’s assume you want to revert changes in a local project, which was previously cloned from the remote repository. In order to do that, first you need to checkout the desired state from the remote repository. For example, if you need to get the project to the state it was in the last week:

git fetch git reset –hard origin/master

If you need to revert changes to the initial commit, you can use the following:

git reset –hard HEAD~1