Rollback a GIT commit

GIT is great, Git is good.

I mostly use git to track changes (very useful to check on what I’ve  been up to when it’s late in the night!) but occasionally I need to use it to roll back to a previous commit. This is the command I always forget, and today it took me more than one minute to find the answer (or formulate the right question) on google.

The answer, unsurprisingly on stackoverflow: in your [git tracked] working directory enter this terminal command:

git reset --hard <tag/branch/commit id>

Where  you replace the gubbins inside the angle brackets with the SHA ID of your commit. Find this easily using GitX or my potential new favourite GIT client on the Mac: Gitti.

  1. No comments yet.

You must be logged in to post a comment.