You might need this mostly if you are unable to pull since the project is not clean. In short, you can use “git reset –hard” to get back to the last commit. But, you can loose the changes you recently made.
Before doing this, I recommend stashing your changes first.
1. Optionally, to get latest info from remote server:
git fetch2. Get to the final commit on master:
git reset --hard origin/masteror to any specific commit:
git reset --hard <commit_id>or to another branch:
git reset --hard origin/<branch_name>3. Cleanup the untracked files:
git clean -dfor cleanup all the other files including the ignored ones:
git clean -df