Elena' s AI Blog

28 Mar 2025 / 3 minutes to read

Elena Daehnhardt

Midjourney AI-generated art

Introduction

git log is a command-line tool that shows the evolution of your project by listing all commits with authors, dates, and messages. It serves as a historical record of feature launches and bug fixes. You can use options like --oneline for a quick overview or -p to see the exact changes made. Filtering by author allows you to highlight specific contributions. Whether you’re diagnosing a bug or celebrating new features, git log keeps you informed and is essential for effective development and collaboration.

Git Log Usage

The git log command shows you the history of commits in your repository. By default, it will list all commits in the current branch, starting from the most recent. Here are a few handy options:

Basic Log

   git log

This displays commit messages, authors, dates, and commit IDs.

```bash
commit b2f6f5db7af5921f32b2742f
Author: Jane Doe <jane@example.com>
Date:   Tue Mar 27 14:50:23 2025 -0400

    Fix bug in user authentication

commit a25ac9abcf384f8655327a8a
Author: John Smith <john@example.com>
Date:   Mon Mar 26 09:15:10 2025 -0400

    Add user profile page

commit 98f530da3fae26554f3d28ed
Author: Jane Doe <jane@example.com>
Date:   Sun Mar 25 10:41:50 2025 -0400

    Initial commit

```

One-Line Format

   git log --oneline

Shows each commit in a single line. This is helpful for scanning a large history quickly.

Show Changes (Patch)

   git log -p

Reveals the actual changes (diffs) introduced by each commit, letting you see what code was added or removed.

Limit the Number of Commits

   git log -n 5

Replace 5 with any number to see only that many commits.

Filter by Author

   git log --author="YourName"

Lists only commits created by the specified author.

In short, git log is your window into a project’s past. You can mix these options to quickly find what you need, whether it’s a specific change or just an overview of the entire commit history.

Conclusion

git log is more than just a command—it’s the storyteller of your software development journey. This powerful tool transforms your project’s commit history into a readable narrative, tracking every significant moment from minor tweaks to major feature launches.

References

  1. Restoring deleted files in Git

  2. git-checkout

Did you like this post? Please let me know if you have any comments or suggestions.

Git posts that might be interesting for you




desktop bg dark

About Elena

Elena, a PhD in Computer Science, simplifies AI concepts and helps you use machine learning.

Citation
Elena Daehnhardt. (2025) '', daehnhardt.com, 28 March 2025. Available at: https://daehnhardt.com/blog/2025/03/28/2025-03-29-git-log/
All Posts