Git cheat sheet

Documentation: https://git-scm.com/about

Restoring deleted file

# show all commits modifying a path 
git log --all --full-history -- **/pi*.py
# show paths modified by a selected commit
git diff-tree --no-commit-id --name-only -r 92bf91c42d8b4f1222e4f5d
# show created / deleted files
git diff-tree --no-commit-id --summary -r 92bf91c42d8b4f1222e4f5d
# show changes introduced by the commit
git show 92bf91c42d8b4f1222e4f5d -- **/pi*
# checkout deleted file ^ denotes previous commit 
git checkout 92bf91c42d8b4f1222e4f5d^ -- <path>

Statistics

# statistics like lines changed/deleted between commits
git diff --stat 39b020dc03 5248ea38f21ae2