Understanding your project's history is essential for debugging regressions and reviewing changes. These commands let you peek back in time.
This command shows you the exact diff and metadata (author, date, message) for a specific commit. The interactive prompt shows you the last 50 commits to choose from.
git show $commitIf you need to see all the changes that happened between two different points in time, you can diff two commits directly. This is extremely useful for seeing everything that changed in a release.
git diff $commit_base $commit_targetInteractive rebasing lets you rewrite history. You can squash multiple commits together, drop bad commits, or edit old commit messages. Pick the earliest commit you want to modify, and Git will open an editor to let you rewrite the history that follows it.
git rebase -i $commit_base~1If you find a bug in a specific line of code and need to know who wrote it (or when it was introduced), git blame annotates every line of a file with its originating commit.
git blame $tracked_fileApply the changes introduced by an existing commit directly to your current branch. #copy-commit #port #steal
git cherry-pick $commitCreate a new commit that undoes all of the changes made in a previous commit, without rewriting history. #undo-pushed #reverse
git revert $commitSummarize the repository history by showing how many commits each author has made. #leaderboard #stats #authors
git shortlog -snCreates a zip or tar archive of the repository at a specific commit. #zip #tar #export #backup
git archive --format=zip --output=$file_name $commit