In this tutorial, we’ll look at how to install and use Lazygit on Linux and macOS. Lazygit is a simple terminal UI for git commands, written in Go with the gocui library. Lazygit enables you to have a feeling of Sourcetree but in a terminal-centric environment. Lazygit is fast and easy to use, you just need to call lazygit in your terminal inside a git repository. Lazygit can run on Linux, macOS, FreeBSD, and Windows.

Features of Lazygit

Below are the cool features of lazygit:

  • Adding files easily
  • Resolving merge conflicts
  • Easily check out recent branches
  • Scroll through logs/diffs of branches/commits/stash
  • Quick pushing/pulling
  • Squash down and rename commits

Below are the panels available on lazygit git commands UI tool

  • Global Panel
  • Files Panel
  • Branches Panel
  • Commits Panel
  • Stash Panel
  • Diff Panel for resolving Merge conflicts.

How to Install lazygit on macOS

You can easily install lazygit on macOS using brew.

$ brew tap jesseduffield/lazygit
$ brew install lazygitbrew tap

How to Install lazygit on Ubuntu

Lazygit packages for Ubuntu are available via Launchpad PPA. Add it to your Ubuntu system then install lazygit.

sudo add-apt-repository ppa:lazygit-team/daily
sudo apt-get update
sudo apt-get install lazygit

How to install Lazygit on Arch Linux

For Arch Linux users, you can install lazygit from AUR.  There are two packages. The stable one which is built (lazygit) with the latest release and the git version (lazygit-git)which builds from the most recent commit.

To be able to install packages from AUR on Arch Linux, you need an AUR helper. Check yay – Best AUR Helper for Arch Linux / Manjaro.

Once you have installed yay, install lazygit like below:

$ yay -S --noconfirm --needed lazygit

For development release, use:

$ yay -S --noconfirm --needed lazygit-git

Install lazygit from binary package

You can also install lazygit from binary packages. Below is an example of installing lazygit from the binary package on Linux.

export VER="0.7.2"
wget -O lazygit.tgz${VER}/lazygit_${VER}_Linux_x86_64.tar.gz
tar xvf lazygit.tgz
sudo mv lazygit /usr/local/bin/

Confirm installation.

$ lazygit  -v
commit=63e2ccfccf32bd7fff2e721940f8173c6194cce5, build date=2019-03-05T10:57:25Z, build source=binaryRelease, version=0.7.2, os=linux, arch=amd64

How to use lazygit for git commands

Execute lazygit command in your terminal inside a git repository

$ lazygit
lazygit linux min 01

Below are lazygit Keybindings:


 ← →↑↓/hjkl:               navigate
  PgUp/PgDn or ctrl+u/ctrl+d:   scroll diff panel 
                                     (for PgUp and PgDn, use fn+up/fn+down on osx)
  q:                                quit
  p:                                pull
  shift+P:                          push

Files Panel:

space:    toggle staged
  c:        commit changes
  shift+C: commit using git editor
  shift+S: stash files
  t:        add patched (i.e. pick chunks of a file to add)
  o:        open
  e:        edit
  s:        open in sublime (requires 'subl' command)
  v:        open in vscode (requires 'code' command)
  i:        add to .gitignore
  d:        delete if untracked checkout if tracked (aka go away)
  shift+R: refresh files

Branches Panel:

 space:   checkout branch
  f:       force checkout branch
  m:       merge into currently checked out branch
  c:       checkout by name
  n:       new branch
  d:       delete branch

Commits Panel:

s:       squash down (only available for topmost commit)
r:       rename commit
g:       reset to this commit

Stash Panel:

 space:   apply
  g:       pop
  d:       drop

Popup Panel:

  esc:     close/cancel
  enter:   confirm
  tab:     enter newline (if editing)

Resolving Merge Conflicts (Diff Panel):

 ←→/hl: navigate conflicts
  ↑↓/kj: select hunk
  space:      pick hunk
  b:         pick both hunks
  z:         undo (only available while still inside diff panel)

Happy lazy git time!. Other git related articles include:

Gitleaks – How to Audit git repository for secrets

How to remove git files, directories in .gitignore from a remote repository

How to Configure GitLab FreeIPA LDAP Authentication

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here