Now that our game is tracked in Git, let's learn how to explore what changes were made, when, and by whom.
Git maintains a complete history of your project through commits. Each commit contains:
- Unique hash ID: A unique identifier to easily reference it in the history.
- Parent commit: Reference to the previous commit, creating a chain.
- Author information: Who made the changes.
- Timestamp: When the changes were applied.
- Commit message: Description of the changes included in that commit.
Additionally, the HEAD pointer is a special label that indicates your current position in the project history. Your project probably looks similar to the below diagram:
---
config:
theme: 'forest'
---
gitGraph
commit id: "9c6ef8a Initial commit"
commit id: "16ac970 Start game documentation"
commit id: "762ac02 Start developer docs" tag: "HEAD"
Everyone prefers viewing the history in different ways, and the community has created many options. Here are a few of the common commands and options you will often use:
git log- Displays a detailed history of the project.git log --oneline- Shows one commit per line, but with less detail.git log --graph- Shows a visual diagram, useful for diverging branches.
git checkout- Moves to a different point in the history (modifies files in your working directory).
-
Show the detailed commit history.
git log
-
Show one commit per line.
git log --oneline
-
Show a visual graph of the commit history.
git log --graph --oneline
🪧 Note: This will look more interesting in a future step when the history is longer.
-
Copy the Commit ID of the
Initial commitentry. Both the long and short form will work. -
Use it to checkout the earlier version.
git checkout <commit id>
🪧 Notice the
README.mdfile was removed.
-
Return to the latest commit on
main. Notice theREADME.mdfile has returned. 🧐git checkout main
-
In the left navigation, open the Source Control tab.
-
Right-click on the Changes header and enable the Graph option.
-
Inspect the Graph panel. Notice the timeline list of your recent commits.
-
Click the commit names to expand a list of the files modified by that commit.
-
With your exploration of the Git history complete, Mona should already be busy checking your work. Give her a moment and keep watch in the comments. You will see her respond with progress info and the next steps.
Having trouble? 🤷
- Use
git log --helpto see all available options for viewing history.


