Loading
Current section: Commands 17 exercises
lesson

Optimizing Git Log Output for Better Workflow

The git log command shows a list of commits in your repository.

By default, the output is verbose and shows detailed information about each commit:

![Git log default view](https://res.cloudinary.com/epic-web/image/upload/v1709678379/tutorials/git-foundations/Screenshot_2024-03-05_at_4.33.18_PM.p

Loading lesson

Transcript

00:00 Git log is used to see a list of commits. This is our commit for adding commit sub-command notes. This is our commit for adding the username and email config note, and we can hit space to continue on through history. Now, this view is a little wordy for me,

00:16 so I prefer git log with the one line flag. Here we see just the most relevant information, eight unique characters from each SHA, the head commit and which branch we're on, and the commit messages. If you like this log format and want to save it to config,

00:33 use the format.pretty one-line option. Now, we can run git log with just SHA, branch, and commit message in one line. Now, you'll notice that this commit is significantly longer. This is the full commit.

00:47 We also need to set the git config log.abbrev commit to true. Let's try that one more time for nice concise log messages with just the git log command. As always, you can inspect your git config with git config list to see which options are being applied.