DEV Community

Cover image for Get lazy with lazygit

Posted on • Updated on

Get lazy with lazygit

As a developer, my assumption is:

You are working with Git literally every hour.
Enter fullscreen mode Exit fullscreen mode

But I wonder, how many times you felt the necessity of a tool that makes the repetitive commands/steps a bit more convenient for the things like:

  • Seeing the diff
  • Quickly stage/unstage files
  • Seeing the logs
  • A tool to quickly open PR regardless of your SCM

Well, that's when lazygit comes to the rescue. It's a terminal UI for git commands written in Go.

Just install it following the instruction from the official repository. Then optionally you can set an alias in your shell configuration to quickly open lazygit. In my case, it's lg.

alias preview

Here are the features I use most of the time from this tool.

  • Stage/unstage like bullet
  • Open a PR with a single keypress
  • Search through commits

Stage/unstage like bullet

Every time performing these type of commands is really a bit painful when a tool like lazygit exists:

  • git add foo.go
  • git add bar.js
  • git logs
  • git diff foo.go

With lazygit you can quickly see through the changed files and stage/unstage them accordingly. As well as, you can see the changes on each file very easily.

Open a PR with a single keypress

This is my favorite feature of this tool. Because every time I commit something and want to create PR/MR, I have to do a bunch of repetitive clicks here and there. On top of that, sometimes I have to work with GitHub, sometimes GitLab. So even if I wanna use the GitHub CLI tool hub or GitLab CLI tool glab, I am ending up using two different tools. So it's nice when I can open PR/MR just by a shortcut within a second or two regardless of what SCM I am on.

Search through commits

When I have to search through a bunch of commits, lazygit comes very handy. Altho there are other tools that exist as well. But I end up utilizing this tool a lot in this case it's I don't have to open another tool or even VS Code for this.

lazygit is open-source. And easy to download and install, so definitely give it a go!

Top comments (5)

waylonwalker profile image
Waylon Walker

Lazy Git looks really cool, I use gitui quite often. The biggest thing I like is that I can quickly see the diff as I am commiting. Works really well when you have a coulple of files to commit, not so much when there are dozens, You end up just spamming arrow keys.

Do you use pre-commit? curious how well lazy.git works with pre-commit.

tahsinature profile image

I think it doesn't support pre-commit yet.

waylonwalker profile image
Waylon Walker

awe, thanks for the info.

thumbone profile image
Bernd Wechner

Have to admit I love gitkraken. It's cross platform, free (freemium actually but one of the few freemium products I love) and has the best visualisation of branches and commits I've seen anywhere.

ps173 profile image
Pratham Sharma

Honestly I love this tool. I use it everywhere. At day job and at home