As a project grows, the number of commits grows with it. After a while, you may need to answer questions such as when a feature was added, what changed recently, or which commit introduced a particular problem.
Git automatically keeps this commit history, and you can inspect it either from the command line or with visual tools.
Viewing History with git log
The basic command is:
git logGit will show the commits in the repository. A commit entry usually contains the commit ID, author, date, and commit message:
commit a7f3c8e1...
Author: Alex Chen <[email protected]>
Date: Mon Aug 24 10:30:00 2026
Update hello messageThe important parts are:
commit → unique identifier for the commit
Author → who created it
Date → when it was created
Message → what the change was about
A commit ID is usually a long string such as:
a7f3c8e124ab...Git uses this value to uniquely identify a commit. In everyday use, you often only need the first few characters because they are usually enough to distinguish one commit from another.
Using git log --oneline
The full git log output contains a lot of information. If you only want a quick overview, a more convenient command is:
git log --onelineThe output becomes much shorter:
a7f3c8e Update hello message
92b1f54 Add hello fileEach line represents one commit.
The first part is the shortened commit ID:
a7f3c8eand the rest is the commit message:
Update hello messageFor quick checks, git log --oneline is often more useful than the full log.
Reading a Commit History
Suppose you see:
f41d129 Fix login error
71e4a93 Add login validation
2528bc1 Add login page
e2b0135 Create projectGit normally shows the newest commit first.
So if we read this history from the bottom upward, the project developed like this:
Create project → Add login page → Add login validation → Fix login error
Even from the commit messages alone, we can already understand how the login feature evolved.
This is another reason good commit messages matter. A history full of messages such as:
update
test
changeis much harder to understand later.
Commit history detective
Inspect history with git log --oneline, then examine the suspicious change with git show f41d129.
—
Inspect history with git log --oneline, then examine the suspicious change with git show f41d129.Viewing History in VS Code
The command line is not the only way to inspect Git history. VS Code and common Git extensions can display commits as lists or visual graphs.
You can select a commit and inspect things such as:
Which files changed
Which lines were added
Which lines were removedFor beginners, this can be easier to understand than reading everything in the terminal.
The exact interface may differ depending on your VS Code version or installed extensions, so this tutorial does not depend on one particular extension. The important idea is that both visual tools and the terminal are reading the same Git commit history.
Viewing Commits on GitHub
Once your repository has been pushed to GitHub, you can also inspect its commit history directly in the browser.
GitHub shows the commit message, author, and time for each commit. Clicking a commit lets you see the files and code changes included in it.
This is especially useful when working in a team. If a piece of code starts behaving incorrectly, you can inspect recent commits on GitHub to see who changed the relevant files and exactly what changed.
One important detail is that GitHub only knows about commits that have been pushed to the remote repository. If a commit exists only on your computer, GitHub cannot see it yet.
KNOWLEDGE QUIZ
A Simple Way to Use These Tools Together
When working locally, you can start with:
git log --onelineto quickly see the commit list.
If you want to understand one commit in more detail, use VS Code to inspect the visual diff. Once the project is on GitHub, you can also inspect the same history online.
A practical way to think about the three options is:
git log --oneline → quick commit overview → VS Code → visual inspection on your computer → GitHub → online commit and diff inspection
Practice
In a repository with at least three commits, run git log --oneline. Select one commit, inspect its diff in VS Code or GitHub, and record its first seven ID characters, message, changed files, and your interpretation of its purpose.