Andrea Daly : Log

Works on file changes that have been committed.

[list commits]

git log

[list commits summary line]

git log --oneline

[view commits that changed a file]

git log <path-filename>

[view changes made to file in commits]

git --no-pager log -p -- <path-filename>

[show list of commits and differences. Can limit the number of returned commits by option]

git log -p -2

[show all files deleted on the branch by commit]

git log --diff-filter D

[show commits where message contains specific word]

git log --grep=<word>

[show commits where specific code/word changed]

git log --pretty=short -S '<word-or-code-snippet>'

[example: git log --pretty=short -S 'thenCallRealMethod()'

[then call show on the commit id]

git show <commit-id>

*omit --pretty=short for more detail on the commits

[show commits where specific code/word added/removed/moved]

git log --pretty=short -G '<word-or-code-snippet>'

[example: git log --pretty=short -G 'thenCallRealMethod()'

[then call show on the commit id]

git show <commit-id>

*omit --pretty=short for more detail on the commits

[show commit id of last commit for a file]

git log -n 1 --pretty=format:%H -- <path-filenam>

[show all files deleted on the branch by filename]

git log --diff-filter D --pretty="format:" --name-only | sed '/^$/d'

https://waylonwalker.com/git-find-deleted-files/#:~:text=Listing%20all%20the%20deleted%20files,that%20happened%20at%20that%20point.