Master Git
If you've been working with Git, you may be familiar with git log
domain. Beyond its basic use (i.e. simple git log
), advanced use of this command can be quite powerful, making browsing repository history smooth and informative. In this post, we will learn some useful ways to use git log
to take your Git knowledge to the next level.
This post assumes that the reader, you, is familiar with basic Git usage. If you need a refresher on Git basics, you might want to check out this article first. To get the most out of this post, I encourage you to practice using the commands while reading the article. We learn faster when we actively practice new knowledge than by passively reading it.
We'll use one of my favorite GitHub repositories: ABSphreak/readme-jokes: Jokes for your GitHub READMEs to demonstrate the use of commands. This awesome lightweight repository allowed me to include random programming jokes on my GitHub profile. Let's start by cloning the repository locally, enter the repository and run simple git log
To update the appearance of the command outputs:
git clone https://github.com/ABSphreak/readme-jokes
cd readme-jokes
git log
The result quickly fills our window and is a bit wordy. Some details, such as the email address, in the result may not be particularly useful most of the time. Let's learn how to get a more concise record.
If you simply want to check the above confirmation messages without additional details, we can add --oneline
option for more concise results:
git log --oneline