Level up your Git knowledge with these 10 useful tips to browse git history | by Zolzaya Luvsandorj | Mar, 2024

Mastering Git

Learn advanced

Towards Data Science

If you have been with Git, you might be familiar with git log command. Beyond its basic usage (i.e. plain git log), the advanced use of this command can be quite powerful, making navigation of ‘s history and informative. In this , we will learn a few useful ways to use git log to bring your Git knowledge to the next level.

by Chris Lawton on Unsplash

This post assumes that the reader, you, are familiar with the basic usage of Git. If you need a refresher on Git basics, you may want to check out this article first. To make most of this post, I encourage you to practice using the commands as you read through the article. We learn faster when we are actively practicing new knowledge than passively reading through it.

We will use one of my favourite GitHub repository: ABSphreak/readme-jokes: 😄 Jokes for your GitHub READMEs to demonstrate the use of commands. This awesome repository allowed me to include random jokes in my GitHub profile. Let’s start by cloning the repo locally, go inside the repository and run simple git log to refresh how the command outputs look like:

git clone https://github.com/ABSphreak/readme-jokes
cd readme-jokes
git log
by author | Keyboard shortcuts used: Use down arrow to see more log output, press q to exit log output.

The output quickly fills up our window and is bit wordy. Some details such as email address in the output may not be particularly useful most of the . Let’s learn how to get more succinct log.

If you simply want to check previous commit messages without extra details, we can add --oneline option to get more concise output:

git log --oneline

Source link