Course contentsShow
← Data Science
Lesson 1999 of 2,14546. Version Control with GitFree lesson

Viewing Commit History

Use `git log` to review the commit history, including commit hashes, authors, dates, and messages.

Viewing Commit History

You'll learn how to use git log to review your project's commit history, revealing who changed what, when, and why.

Now that you've made several commits to your repository, you need a way to look back through your project's history. Think of git log as a time-stamped journal of your project—every entry shows you a snapshot of progress, complete with details about who made the change, when they made it, and their explanation for why.

Understanding git log

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

  • Commit hash: A unique 40-character identifier (like a3f2b8c...)
  • Author: Name and email of who made the commit
  • Date: When the commit was created
  • Message: The explanation you provided with git commit

Basic Usage

# View full commit history
git log

# View compact one-line summaries
git log --oneline

# View last 5 commits only
git log -5

# See what changed in each commit
git log -p

Why This Matters for Data Science

When analyzing data over time or collaborating with team members, you need to trace when a particular analysis was run, which version of a model was trained, or who updated a critical preprocessing script. The commit history becomes your audit trail—essential for reproducibility and debugging.

If your model suddenly performs differently, git log helps you identify exactly when the change occurred and what modifications were made to your code or parameters.

Key Takeaway: git log is your project's historical record, letting you trace every change through commit hashes, authors, dates, and messages—critical for reproducibility and collaboration in data science projects.