You need to rollback to a previous commit and don’t care about recent changes. What commands should you use?

Technology CommunityCategory: GitYou need to rollback to a previous commit and don’t care about recent changes. What commands should you use?
VietMX Staff asked 3 years ago

Let’s say you have made mulitple commits, but the last few were bad and you want to rollback to a previous commit:

git log // lists the commits made in that repository in reverse chronological order
git reset --hard <commit-sha1> // resets the index and working tree