Course contentsShow
← Computer Science
Lesson 2175 of 2,87249. Version Control with GitFree lesson

Viewing Commit History

Navigate commit history with 'git log' and understand commit hashes, authors, and timestamps.

Viewing Commit History

You'll learn how to explore your repository's timeline using git log and interpret the information each commit contains.

What is Commit History?

Think of your Git repository as a detailed journal. Every time you commit changes, Git writes a new entry with a unique identifier, who made the change, when it happened, and what the change was about. Viewing commit history is like flipping through that journal to see how your project evolved over time.

Using git log

The git log command displays your repository's commit history in reverse chronological order (newest first). Each commit entry shows:

Commit hash: A long hexadecimal string (like a3f8b21c4d...) that uniquely identifies that commit—think of it as a fingerprint. You typically only need the first 7 characters for most operations.

Author: The name and email of the person who made the commit.

Date/Timestamp: When the commit was created.

Commit message: The description you wrote explaining what changed.

Reading the Output

When you run git log, you'll see entries like:

commit a3f8b21c4d7e9f2b5c8a1e3d6f9b2c5a8e1d4f7b
Author: Jane Developer <jane@example.com>
Date:   Mon Jan 15 14:32:10 2024 -0500

    Fix login validation bug

This tells you exactly what changed, who changed it, and when—the essential information for understanding your project's evolution and potentially reverting to earlier states if needed.

Key Takeaway: git log lets you navigate your repository's timeline by displaying commit hashes, authors, timestamps, and messages—giving you complete visibility into your project's history.