Visualize the progress of your projects with Git. Recording changes is one of Git's greatest strengths. Whether for small personal projects or large teamwork, the ability to revert to previous versions at any time is indispensable. In this tutorial, you will learn how to view all commits in your Git repository and which practical commands can help you effectively manage the history.
Key Insights
- Git records all changes and allows tracking of all commits.
- With different git log options, you can display, for example, only the latest changes or specific details.
- You can revert to previous versions and track your changes.
View History
To check the history of your commits, use the command git log. This command displays all previous commits, starting with the latest.

With the git log command, you see an overview of the commits made. The last three commits are shown at the beginning.
Each commit is accompanied by a commit message that describes what was changed. You also have information like the author and the date, which helps you understand the context of the changes.
Bradford, the commit message, like "Readme added", is often used to document the changes made.
Detailed Commit Information
Each commit has a unique ID that serves for identification. This ID is used for tracking and to return to a specific state of your project.
If you want to return to the previous state of your files, you can use the commit ID to do so. This gives you the flexibility to restore old versions even if you've made mistakes in later changes.
Jumping back is particularly useful when you're experimenting with different versions and are unsure which changes are sensible.
Customize Git Log Commands
The default command returns a long list that can sometimes be overwhelming. You can customize the command to filter the output and highlight what is important to you. For detailed outputs, you can use git log -p.

This command displays changes in the files for each commit.
If you want to see only the last two lines of changes, git log -p -2 is a good way to summarize the information compactly.

If you want to limit the commit messages to a single line, you can use git log --oneline. This gives you a simplified view of the latest commits.
Custom Formats for Commit Messages
To further optimize the display, you can also define your own format. With the argument --pretty=format:, you can shape the output accordingly. An example would be:
The %h stands for the abbreviated commit ID and %s for the commit message.

This adjustment is particularly advantageous when you want to quickly access important information, such as when searching for specific commits.
Summary – Effectively Display the History of All Commits with Git
In this guide, you have learned how to view and customize the history of your Git commits. The command git log is your key to the changes in your project. You can filter and customize the output to obtain exactly the information you need. Jumping back to previous versions also provides you with the assurance that you can fix mistakes easily.
Frequently Asked Questions
How do I see all commits in my Git repository?Use the command git log to display all commits.
Can I jump back to a specific commit?Yes, use the commit ID with the command git checkout.
What do the different pieces of information in the log mean?The log displays the commit ID, author, date, and commit message.
How can I customize the log output?You can use options like -p, -2, or --oneline to change the display.
Can I create a custom format for the log command?Yes, you can customize the command with git log --pretty=format: to display specific information.