Amending changes in a commit without modifying the message
git commit -a --amend --no-edit
Displaying only the files modified in a commit
git show --pretty="" --name-status <commit-ref>
Browsing the repository on a local web interface
git instaweb
(It requires lighttpd or other httpd daemon. Props to Cool git commands for this one.)
Search git history for a specific string
git log -S '<searchString>'
Bring a file from a specific commit
Useful when you want to try everything with the content of your current state, but you want a file/folder to have contents of a specific commit.
git checkout -- <file-or-folder-path>
Update submodules to the latest branch they’re tracking
git submodule update --recursive --remote
Check references where the main
branch has been for the past 2 weeks
git reflog main@{2.weeks.ago}