- 01Getting Started
- 02What Is Git? Understanding Version Control
- 03Checking the Current State with git status
- 04Understanding the "Staging Area"
- 05Recording Changes with git commit
- 06Viewing History with git log
- 07Viewing Changes with git diff
- 08What Is a Branch?
- 09Switching Branches with git checkout
- 10Merging Branches with git merge
- 11Remote Repositories and git remote
- 12Sending Changes with git push
- 13Getting Code with git pull and git clone
- 14Shelving Work Temporarily with git stash
- 15Marking Releases with git tag
- 16Unstaging with git reset
- 17Untracking a File with git rm
- 18Ignoring Files with .gitignore
- 19Deleting a Branch with git branch -d
- 20Setting Your Name with git config
- 21Viewing the Latest Commit with git show
- 22Fetching Remote Info Only with git fetch
- 23Viewing History Compactly with git log --oneline
- 24Finding Who Changed a File with git blame
- 25Undoing a Commit with git revert
- 26Fixing the Last Commit with git commit --amend
- 27Viewing the Staged Diff with git diff --staged
- 28Visualizing History with git log --graph
- 29Switching Branches with git switch (the Newer Syntax)
- 30Renaming a Branch with git branch -m
- 31Filtering History by Author with git log --author
- 32Deleting a Stash with git stash drop
- 33Deleting a Tag with git tag -d
- 34Listing Remotes with git remote -v
- 35Replaying Your Branch with git rebase
- 36Viewing Changed Files Alongside History with git log --stat
- 37Staging and Committing Together with git commit -a
- 38Discarding File Changes with git checkout --
- 39Picking Just One Commit with git cherry-pick
- 40Recording a Rename with git mv
- 41Checking HEAD's Movement History with git reflog
- 42Applying a Stash Without Removing It with git stash apply
- 43Creating an Annotated Tag with git tag -a
- 44Filtering History by Date with git log --since
- 45Viewing the Actual Changes with git log -p
- 46Getting Just the Current Branch Name with git branch --show-current
- 47Creating an Empty Commit with git commit --allow-empty
- 48Searching Commit Messages with git log --grep
- 49Removing a Remote with git remote remove
- 50Understanding the Danger of git push --force
- 51Counting Commits per Author with git shortlog
- 52Returning to Your Previous Branch with git switch -
- 53Viewing One File's Diff with git diff <file>
- 54Listing Your Settings with git config --list
- 55Checking Status Compactly with git status -s
- 56Adding Only Changes with git commit --amend --no-edit
- 57Mastering the git commit -am Shorthand
- 58Adding a Message to a Stash with git stash push -m
- 59Searching Tags by Pattern with git tag -l
Viewing History with git log
This lesson covers checking commit history with git log. It's for anyone searching "git log usage."
git log shows your commit history so far — when each commit happened and what message it carried. Use it to look back over a project's progress.
In Try It, run git log. The long string of letters and numbers next to each commit is called a "commit hash" — a unique ID for that commit. This opens in a pager view; scroll with the arrow keys and press q to exit.
A common early mistake is not knowing about the q key and getting stuck in the pager view, unsure how to get back to the prompt — a genuinely confusing moment if you're new to the terminal. In real teams, log is routinely sorted oldest-first or newest-first and filtered down to a specific range, which makes it a go-to tool when tracking down when a bug was introduced.
🧑💻 You can type this command into the Git pseudo terminal to try it yourself (this page itself has no interactive terminal).
