If you’re a programmer, you probably use Git, and like me, you may find some commands a little too laborious. What you need is a quick way to comprehend, navigate, and inspect your Git history. GUIs excel in this regard, but if you’re a devoted terminal user, then you likely prefer a TUI (terminal user interface). For Git, these are in short supply, but I have one today, which makes reading your history a breeze.
I love the terminal, and I work almost exclusively within it. It’s not perfect though, since the tricky commands I use most often require a lot of labor. Git is a prime example; I can do much with it, but typing some commands thousands of times becomes a burden. Lazygit simplifies Git interactions in many ways, but in particular, I can rapidly execute commands that are far more suitable as navigational controls—for example, browsing my history, viewing branches, and filtering the history by file.
Related
These 7 TUIs Will Bring Your Terminal Experience Up-to-Date
GUIs are great but TUIs are terrific!
Easily browse history and diffs
This was the primary feature that drew me to lazygit. Instead of writing git diff or git diff HEAD~1, you can navigate the history with the J (move down) and K (move up) keys. The diff view for each selected commit appears in the preview pane, which you can scroll with Shift+J and Shift+K.
In addition, it’s also possible to toggle through different view modes by pressing Shift+Plus.
But what about git diff HEAD~N? How do you achieve that? This is where graphical interfaces shine. Press Shift+W on a commit and move up or down the history. The diffs will accumulate in the preview pane.
Moving through Git’s history this way is far more convenient than trying to probe it with commands because each one requires a typed-out reconfiguration, which slows me down. With lazygit, I never need to leave the terminal, and each probe takes only milliseconds.
Visual branching graphics
Branching is a fundamental part of Git, and you can’t avoid it. To view a graph of branches with the CLI, we can use git log –oneline –graph.
With lazygit, I get that for free. By default, when I create branches, lazygit displays them using a sleek set of lines:
The circles represent commits, and the lines are the branch hierarchy. The present view only shows branches reachable via the current one, but you can toggle all branches by pressing Ctrl+L and selecting the appropriate option.
I typically use git merge –squash foo on my main branch, but if you prefer to rebase in your feature branches, lazygit provides convenient keymaps to do so:
Key
Action
D
Drop
E
Edit
F
Fixup
R
Reword
S
Squash
And in step with lazygit’s UX, you can select the necessary commits via the history panel.
Search and filtering reduces noise
Searching is arguably more powerful on the command line, but you still need to type long commands frequently. If you’ve chosen to make lazygit part of your workflow, then missing features would be a big sticking point. Fortunately, lazygit includes most of the common Git operations, including search and filtering; however, it’s not perfect.
For simple commit messages, you can search for them by pressing the forward slash key. It searches only for what’s visible. Most times this will do, but if you need to search for the commit body, it’s best to use the command line. While lazygit allows you to access its built-in command line by pressing the colon key, you probably have a more advanced shell setup to assist you instead.
Filtering for commits that involve a specific file is extremely useful, and lazygit makes it easy. Press Ctrl+S when you have the history panel selected, and it will present options to filter by path or author.
These are obviously not every feature that lazygit offers, but a slice that focuses on your Git history. For example, it also provides colored local/remote status indicators that describe whether you’ve pushed changes, granular staging, cherry-picking, commit reordering, and deletions, etc.
Lazygit, while imperfect, covers most common Git features, and with its nimble Vim-style keymaps, it’s easy to explore the history of your project. Whether you’re spanning branches or need a custom view over selected commits, lazygit can provide that and more.
If you’re interested in it, head over to the installation section of their GitHub repository and follow the instructions. Alternatively, you can easily install it via UBI.
Related
I ditched GitHub and self-hosted my own private alternative
I trust myself more than I trust GitHub or Microsoft.

