Git Basics II

From Ry's Git Tutorial

> git checkout <commit-id>

View a previous commit

> git tag -a <tag-name> -m "<description>"

Create an annotated tag pointing to the most recent commit

> git revert <commit-id>

Undo the specific commit by applying a new commit

> git reset --hard

Git reset tracked files to match the most recent commit

> git clean -f

Remove untracked files

> git reset --hard / git clean -f

Permanently undo committed changes


The git reset command undoes changes to the working directory and the staged snapshot, while git revert undoes changes contained in committed snapshots. Not surprisingly, git status and git log directly parallel this behaviour.