Here is a random (and definitely incomplete) collection of git commands, mostly for my own reference, as I keep looking them up over and over again when I need them.

1. To switch temporarily to an old commit, use

  git checkout <commit-id>

To return to the head, do

  git checkout master

2. To restore a specific file that may have ben deleted, from the upstream repo:

  git checkout origin/master -- <path/to/file>

3. To see what a specific commit did:

  git show <commit-id>

4. To see the history of a specific file:

  git log -p -- <filename>

5. Revert a specific commit (not tested lately):

  git revert --no-commit <commid-id>

This reverts all files affected by the specified commit. If there was a file we'd rather NOT revert, we can discard the revert by

  git checkout <filename>

The --no-commit option ensured that the revert was not committed yet, so we can do our own edits if needed, followed by, e.g.,

  git commit -a -m "Revert commit ..."

 

There will be more to come.