How do you roll back (reset) a Git repository to a particular commit?
git
Solution
git reset --hard <tag/branch/commit id>
Notes:
`git reset` without the `--hard` option resets the commit history, but not the files. With the `--hard` option the files in working tree are also reset. (credited user)
If you wish to commit that state so that the remote repository also points to the rolled back commit do: `git push <reponame> -f` (credited user)
Problem
I cloned a Git repository and then tried to roll it back to a particular commit early on in the development process. Everything that was added to the repository after that point is unimportant to me so I want to omit all subsequent changes from my local source code. However, when I try to roll back in the GUI tool it doesn't update my local file system - I always end up with the latest source code for the project. What's the correct way to just get the source for a repository as of a particular commit in the project's history and omit all later updates?