Lazygit - simple terminal UI for git commands

Overview

CI Go Report Card GolangCI GoDoc GitHub tag TODOs

A simple terminal UI for git commands, written in Go with the gocui library.

Rant time: You've heard it before, git is powerful, but what good is that power when everything is so damn hard to do? Interactive rebasing requires you to edit a goddamn TODO file in your editor? Are you kidding me? To stage part of a file you need to use a command line program to step through each hunk and if a hunk can't be split down any further but contains code you don't want to stage, you have to edit an arcane patch file by hand? Are you KIDDING me?! Sometimes you get asked to stash your changes when switching branches only to realise that after you switch and unstash that there weren't even any conflicts and it would have been fine to just checkout the branch directly? YOU HAVE GOT TO BE KIDDING ME!

If you're a mere mortal like me and you're tired of hearing how powerful git is when in your daily life it's a powerful pain in your ass, lazygit might be for you.

Gif

Table of contents

Github Sponsors is matching all donations dollar-for-dollar for 12 months so if you're feeling generous consider sponsoring me

Installation

Binary Releases

For Windows, Mac OS(10.12+) or Linux, you can download a binary release here.

Homebrew

Normally the lazygit formula can be found in the Homebrew core but we suggest you tap our formula to get the frequently updated one. It works with Linux, too.

Tap:

brew install jesseduffield/lazygit/lazygit

Core:

brew install lazygit

MacPorts

Latest version built from github releases. Tap:

sudo port install lazygit

Ubuntu

Deprecated: will no longer receive updates.

Packages for Ubuntu are available via Launchpad PPA.

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

Void Linux

Packages for Void Linux are available in the distro repo

They follow upstream latest releases

sudo xbps-install -S lazygit

Scoop (Windows)

You can install lazygit using scoop. It's in the extras bucket:

# Add the extras bucket
scoop bucket add extras

# Install lazygit
scoop install lazygit

Arch Linux

Packages for Arch Linux are available via pacman and AUR (Arch User Repository).

There are two packages. The stable one which is built with the latest release and the git version which builds from the most recent commit.

Instruction of how to install AUR content can be found here: https://wiki.archlinux.org/index.php/Arch_User_Repository

Fedora and CentOS 7

Packages for Fedora and CentOS 7 are available via Copr (Cool Other Package Repo).

sudo dnf copr enable atim/lazygit -y
sudo dnf install lazygit

Solus Linux

sudo eopkg install lazygit

Funtoo Linux

Funtoo Linux has an autogenerated lazygit package in dev-kit:

sudo emerge dev-vcs/lazygit

FreeBSD

pkg install lazygit

Conda

Released versions are available for different platforms, see https://anaconda.org/conda-forge/lazygit

conda install -c conda-forge lazygit

Go

go get github.com/jesseduffield/lazygit

Please note: If you get an error claiming that lazygit cannot be found or is not defined, you may need to add ~/go/bin to your $PATH (MacOS/Linux), or %HOME%\go\bin (Windows). Not to be mistaked for C:\Go\bin (which is for Go's own binaries, not apps like Lazygit).

Chocolatey (Windows)

You can install lazygit using Chocolatey:

choco install lazygit

Manual

You'll need to install Go

git clone https://github.com/jesseduffield/lazygit.git
cd lazygit
go install

You can also use go run main.go to compile and run in one go (pun definitely intended)

Usage

Call lazygit in your terminal inside a git repository.

$ lazygit

If you want, you can also add an alias for this with echo "alias lg='lazygit'" >> ~/.zshrc (or whichever rc file you're using).

Keybindings

You can check out the list of keybindings here.

Changing Directory On Exit

If you change repos in lazygit and want your shell to change directory into that repo on exiting lazygit, add this to your ~/.zshrc (or other rc file):

lg()
{
    export LAZYGIT_NEW_DIR_FILE=~/.lazygit/newdir

    lazygit "$@"

    if [ -f $LAZYGIT_NEW_DIR_FILE ]; then
            cd "$(cat $LAZYGIT_NEW_DIR_FILE)"
            rm -f $LAZYGIT_NEW_DIR_FILE > /dev/null
    fi
}

Then source ~/.zshrc and from now on when you call lg and exit you'll switch directories to whatever you were in inside lazyigt. To override this behaviour you can exit using shift+Q rather than just q.

Undo/Redo

See the docs

Configuration

Check out the configuration docs.

Custom Pagers

See the docs

Custom Commands

If lazygit is missing a feature, there's a good chance you can implement it yourself with a custom command!

See the docs

Tutorials

Cool features

  • 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 reword commits

Resolving merge conflicts

Gif

Interactive Rebasing

Interactive Rebasing

Contributing

We love your input! Please check out the contributing guide. For contributor discussion about things not better discussed here in the repo, join the slack channel

Slack

Debugging Locally

Run lazygit --debug in one terminal tab and lazygit --logs in another to view the program and its log output side by side

Donate

If you would like to support the development of lazygit, consider sponsoring me (github is matching all donations dollar-for-dollar for 12 months)

FAQ

I'm struggling to see the selected line

see here

Social

If you want to see what I (Jesse) am up to in terms of development, follow me on twitter or watch me program on twitch.

Alternatives

If you find that lazygit doesn't quite satisfy your requirements, these may be a better fit:

Comments
  • Add password and/or username question  #81 #145

    Add password and/or username question #81 #145

    Today i found a fix for #81 #145 (only for UNIX based systems)
    Using this fix it's possible to fully run git push in the background and send every new word that the terminal prints to a function and write data to the terminal from that function without having any side effects from and to gocui

    Note: This fix doesn't work on windows due to a compile error that's why i fallback on the old way for windows There are a view ways to get this working on windows but there are a lot of problems that come with that like when you run this from git bash it executes the sub process in another shell what maybe doesn't have git and the amount of extra code to add to only get this working on windows. a view other things you'll probably need can be found here

    opened by mjarkk 41
  • WIP: Add menu panel (cheatsheet)

    WIP: Add menu panel (cheatsheet)

    My proposition is to add 2 new fields to Binding struct. One for human readable key (i don't know how to pretty print current Key field value) and the other one simply for description of what this key is responsible for. Then we can straightforwardly generate a cheatsheet on the fly. Possible in the future we'll be able to simply export this cheatsheet to separate file and for example put it on github as a replacement for manually written Keybindings.md.

    Panel is currently set to maximum width and height, i think it's convenient.

    Closes: #237

    opened by dawidd6 41
  • Password not prompting

    Password not prompting

    Maybe I am missing something, but I use ssh key for Github, whenever I select to push in lazygit, it does not prompt for my password, so it never pushes

    discussion 
    opened by ndowens 38
  • Use the git builtin GIT_ASKPASS in staid of a PTY

    Use the git builtin GIT_ASKPASS in staid of a PTY

    image

    Because there where a view problems with the use of a PTY and no windows support i was thinking about another way of handling the credentials.

    Git actually has a shell variable called GIT_ASKPASS where you can define a program that can be used by git to ask for credentials

    This fix works like this:

    • When spawning a tty with a git command include the GIT_ASKPASS shell variable with the lazygit program location
    • When git needs a username or password it asks Lazygit for that
    • Lazygit detects it's ran from git and asks the host lazygit for a username/password via a rpc server running on the host.
    • When the host returns a username or password it prints the output and git uses that as credentials

    After some testing this fix seems to works perfectly on Linux, Windows, Windows subsystem and works with private as well as public repositories

    I've not tested this on macOS
    On windows it will show on first usage a firewall popup asking if you want to give this program network access.

    This is still work in progress because the credentials are currently send as raw text over the network what would not be a great idea and the firewall popup is not needed on windows.

    @jesseduffield What do you think about this way of solving the problem?

    opened by mjarkk 38
  • [WIP] GUI: Rework part 1

    [WIP] GUI: Rework part 1

    | | format | imports | comments | g passing | error checking | error logging | | :-------------------------------- |:--------:|:----------:|:--------------:|:-------------:|:-------------------:|:-----------------:| | app_status_manager |X |X |X |X |X |X | | branches_panel |X |X |X |X |X |X | | commit_message_panel |X |X |X |X |X |X | | commits_panel |X |X |X |X |X |X | | confirmation_panel |X |X |X |X |X |X | | files_panel |X |X |X |X |X |X | | gui |X |X |X |X |X |X | | keybindings |X |X |X |X |X |X | | main_panel |X |X |X |X |X |X | | menu_panel |X |X |X |X |X |X | | merge_panel |X |X |X |X |X |X | | stash_panel |X |X |X |X |X |X | | status_panel |X |X |X |X |X |X | | theme |X |X |X |X |X |X | | updates |X |X |X |X |X |X | | view_helpers |X |X |X |X |X |X |

    opened by glvr182 27
  • Added a view basic translation functions and translation file

    Added a view basic translation functions and translation file

    What do you think of this way of translations?
    Currently it doesn't auto detect the system language because i don't know how to detect that but the translation works when you change the language.English to language.Dutch

    opened by mjarkk 24
  • On mac, runnning lazygit in a tmux popup pane fails

    On mac, runnning lazygit in a tmux popup pane fails

    Describe the bug On Mac, when using tmux popup pane feature: tmux popup -E "lazygit", I get *exec.ExitError status 1 as seen in screenshot below. If not running Lazygit in a tmux popup pane, that is in a regular tmux session, it works as expected.

    To Reproduce Steps to reproduce the behavior:

    1. On Mac, run tmux
    2. type command `tmux popup -EE "lazygit"
    3. floating window shows "An error occurred..."

    Expected behavior I have installed lazygit version 0.34 and tmux version 3.3a on both Ubuntu 20.04.4 LTS and WSL. They both run as expected. See Additional context for screenshots of expected behaviour

    Screenshots Screen Shot 2022-06-11 at 3 20 39 PM

    Desktop (please complete the following information):

    • OS: Darwin
    • Lazygit Version: 0.34

    Additional context This is what I get when using a Linux machine or WSL which is the expected behaviour: WbpC5XK

    bug 
    opened by carjuan 22
  • git push / pull breaks when asked for username / password

    git push / pull breaks when asked for username / password

    Describe the bug Hangs when inside the git config the git username is saved and password is NOT (cache time is over)

    To Reproduce Steps to reproduce the behavior:

    1. $ git config credential.helper store
    2. $ git config credential.helper cache 1
    3. Try to push something using lazygit

    Expected behavior No program hang

    Screenshots screenshot from 2018-08-14 21-08-02

    Desktop (please complete the following information):

    • OS: Linux (fedora 4.17.12-200.fc28.x86_64)
    • Shell: bash
    • Lazygit v0.1.59
    opened by mjarkk 22
  • "panic: close of nil channel" running lazygit in zsh

    Describe the bug Basically just the title... running lazygit in zsh 5.8 on macOS. It could be something with my go config - I'm a total go newbie.

    To Reproduce Steps to reproduce the behavior:

    1. Install lazygit via homebrew (brew install lazygit)
    2. Run lazygit
    3. Receive the following error:
    panic: close of nil channel
    
    goroutine 1 [running]:
    github.com/jesseduffield/lazygit/pkg/gui.(*Gui).RunWithSubprocesses(0xc0001984e0, 0x0, 0x0)
            /Users/gary/code/go/src/github.com/jesseduffield/lazygit/pkg/gui/gui.go:382 +0x115
    github.com/jesseduffield/lazygit/pkg/app.(*App).Run(0xc00027fc70, 0xc0000d8800, 0x0)
            /Users/gary/code/go/src/github.com/jesseduffield/lazygit/pkg/app/app.go:165 +0x6b
    main.main()
            /Users/gary/code/go/src/github.com/jesseduffield/lazygit/main.go:70 +0x7f3
    

    Expected behavior lazygit should open my repo

    Desktop (please complete the following information): macOS 10.15.5 lazygit 0.20.4

    bug 
    opened by garymh 21
  • Display the git graph

    Display the git graph

    How it works:

    • each 'pipe' in the graph is coloured based on the author of the descendant commit. When selecting a commit, the pipes to its ancestors will be highlighted in white to remove any ambiguity.
    • to get the graph looking good, we're sorting the git log in topological order as opposed to committer date. I'm pretty sure this won't have any effect on interactive rebases (those drop merges by default anyway)

    When you're looking at a section of the graph that's dominated by a single author, it does make it harder to grok what's going on, but when there's a mix of authors, having the pipes coloured by author makes it much better than using random pipe colours. Not sure whether to make that setting configurable.

    https://user-images.githubusercontent.com/8456633/139527896-316b9980-f604-4170-94bd-c7883ce0e902.mov

    image

    opened by jesseduffield 20
  • Facilitate toggling whitespace in the diff view with a hotkey (c-w by default)

    Facilitate toggling whitespace in the diff view with a hotkey (c-w by default)

    I often use an auto-formatter to format a file and find that the entire file is reformatted (which is fine), but when the time comes to view what's important in the changeset, I just want to see functional changes. So being able to diff without whitespace can be really useful. Also really useful when dealing with, eg, changed .editorconfig causing reformats.

    This PR probably needs some commentary. ~I don't have any tests - I'm not sure how to implement them, tbh~. I've added a test around the cli that would be output, not sure if there's more I should do test-wise. My go-fu is weak. This little change took me about an hour to figure out 😐

    Here it is in action: lazygit-whitespace-toggle

    opened by fluffynuts 19
  • Add border config

    Add border config

    • PR Description Allow border changes in border configuration
    • Please check if the PR fulfills these requirements
    • [x] Cheatsheets are up-to-date (run go run scripts/cheatsheet/main.go generate)
    • [x] Code has been formatted (see here)
    • [ ] Tests have been added/updated (see here for the integration test guide)
    • [x] Text is internationalised (see here)
    • [x] Docs (specifically docs/Config.md) have been updated if necessary
    • [x] You've read through your own file changes for silly mistakes etc
    opened by yk-kd 0
  • change `git.commit.verbose` to accept

    change `git.commit.verbose` to accept "default"

    • PR Description

    ref: https://github.com/jesseduffield/lazygit/pull/2341

    change to ignore git config commit.verbose if git.commit.verbose is false.

    • Please check if the PR fulfills these requirements
    • [x] Cheatsheets are up-to-date (run go run scripts/cheatsheet/main.go generate)
    • [x] Code has been formatted (see here)
    • [x] Tests have been added/updated (see here for the integration test guide)
    • [x] Text is internationalised (see here)
    • [x] Docs (specifically docs/Config.md) have been updated if necessary
    • [x] You've read through your own file changes for silly mistakes etc
    opened by Ryooooooga 0
  • Override GIT_SEQUENCE_EDITOR for rebase commands

    Override GIT_SEQUENCE_EDITOR for rebase commands

    • Override GIT_SEQUENCE_EDITOR for rebase commands

    I noticed that $GIT_SEQUENCE_EDITOR is overridden in PrepareInteractiveRebaseCommand but not in runSkipEditorCommand.

    Before this change, some commands such as SquashAllAboveFixupCommits would not work when a different sequence editor, e.g. git-interactive-rebase-tool is configured.

    • Please check if the PR fulfills these requirements
    • [x] Cheatsheets are up-to-date (run go run scripts/cheatsheet/main.go generate)
    • [x] Code has been formatted (see here)
    • [x] Tests have been added/updated (see here for the integration test guide)
    • [x] Text is internationalised (see here)
    • [x] Docs (specifically docs/Config.md) have been updated if necessary
    • [x] You've read through your own file changes for silly mistakes etc
    opened by knutwalker 0
  • [Windows] git diff is not shown using delta as pager in lazygit, but works fine in command line in terminal

    [Windows] git diff is not shown using delta as pager in lazygit, but works fine in command line in terminal

    Describe the bug As shown below, I can see the diff of a local git repo using git diff with delta as the pager in the terminal.

    However, lazygit doesn't show this diff in the "delta way" although I have specified delta as its pager.

    My .gitconfig and config.yml for lazygit are shown below.

    Strangely, the same configuration works fine in Mac OS with git diff highlighted with delta in both command-line and lazygit...

    May I ask what important steps I may have missed here?

    Thanks.

    To Reproduce (As described above)

    Expected behavior (As described above)

    Screenshots running git diff in command-line: 2022-12-28-15-13-49

    git diff as shown in lazygit: 2022-12-28-15-10-31

    My git config file ~/.gitconfig

    [user]
    	name = USER
    	email = [email protected]
    [core]
    	pager = delta
    [interactive]
        diffFilter = delta --color-only --features=interactive
    [delta]
        navigate = true    
        light = false      
        side-by-side = true  
        line-numbers = true   
        features = decorations	 
    [delta "interactive"]
        keep-plus-minus-markers = true
    [delta "decorations"]
        commit-decoration-style = blue ol
        commit-style = raw
        file-style = omit
        hunk-header-decoration-style = blue box
        hunk-header-file-style = red
        hunk-header-line-number-style = "#067a00"
        hunk-header-style = file line-number syntax
    [merge]
        conflictstyle = diff3
    [diff]
        colorMoved = default
    

    My lazygit config file ~/AppData/Roaming/lazygit/config.yml (I was directed to ~/AppData/Roaming when I pasted %APPDATA% in File Explorer.)

    git:
      paging:
        colorArg: never
        pager: delta --dark --paging=never 
        # pager: ydiff -p cat -s --wrap --width={{columnWidth}}   
        useConfig: false
    

    Version info: Run lazygit --version and paste the result here: commit=d1a8b05401ccda1e52215203139a252eb3be3b79, build date=2022-11-14T09:22:31Z, build source=binaryRelease, version=0.36.0, os=windows, arch=amd64, git version=2.34.1.windows.1

    Run git --version and paste the result here git version 2.34.1.windows.1

    Additional context OS: Windows 11 Pro, 64bit, 22H2, build 22621.963

    Reference read #2300

    Note: please try updating to the latest version or manually building the latest master to see if the issue still occurs.

    bug 
    opened by hopezh 0
  • The text is not properly formatted during the first launch

    The text is not properly formatted during the first launch

    Describe the bug When launching lazygit for the first time after installation, there is a problem related to the text formation. As I marked in red, the text is not correctly formatted because there is an additional new line, which I think may be a bug.

    image

    To Reproduce Steps to reproduce the behavior:

    1. Install lazygit on Ubuntu 22.04.1 LTS
    2. Lunch lazygit by typing lazygit
    3. You may see the bug I reported

    Expected behavior There should be no extra line if the text is properly formatted. 

    Screenshots Please see above.

    Version info: lazygit --version: commit=d1a8b05401ccda1e52215203139a252eb3be3b79, build date=2022-11-14T09:22:31Z, build source=binaryRelease, version=0.36.0, os=linux, arch=amd64, git version=2.34.1

    git --version: git version 2.34.1

    bug 
    opened by ZhengLin-Li 0
  • Revamping the commit message window

    Revamping the commit message window

    Is your feature request related to a problem? Please describe. Currently we cannot insert newlines consistently, nor can we go to previous messages.

    Describe the solution you'd like I wanna be able to insert newlines and go to previous messages.

    Describe alternatives you've considered vim

    Additional context

    We could revamp it so that the popup has two parts, like the custom command popup. The first one would just for the summary of the commit, with options such as:

    • pressing Up or Down goes to the previous or next commit message, respectively
    • pressing Enter would confirm the commit (just like it does now)
    • pressing Tab would go to the part below

    The lower one would be for the description of the commit with the following features:

    • pressing Enter would insert a newline
    • pressing Up or Down would move the cursor Up or Down
    • pressing Tab would switch back to the upper textbox

    The discussion is here.

    enhancement good first issue 
    opened by mark2185 0
Releases(v0.36.0)
Owner
Jesse Duffield
Creator of lazygit, lazydocker, and horcrux.
Jesse Duffield
Workflows make it easy to browse, search, execute and share commands (or a series of commands)--without needing to leave your terminal.

Workflows The repo for all public Workflows that appear within Warp and within commands.dev. To learn how to create local or repository workflows, see

Warp 227 Jun 1, 2022
🌌⭐cosmo is a wrapper for Git essentially, allowing you to compress multiple commands into one

❯ Cosmo Git tooling of the future New feature: Cosmo hooks! Click here for more info! ❯ ?? Features Config files (with defaults!) Fast Easy to use Fri

Jack 1 Oct 31, 2021
A Rust CLI tool that helps you enforce Git policies through Git hooks both server and client side

GitPolicyEnforcer This is a command line utility written in Rust, that helps you utilize Git hooks, to enforce various policies. It currently supports

Vagelis Prokopiou 4 Aug 14, 2022
git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers.⛰️

git-cliff can generate changelog files from the Git history by utilizing conventional commits as well as regex-powered custom parsers. The changelog template can be customized with a configuration file to match the desired format.

Orhun Parmaksız 5k Jan 9, 2023
A git sub-command to view your git repository in the web browser

git-view A git sub-command to view your git repository in the web browser! About Are you also frustrated from moving your hands away from the keyboard

Hamothy 5 Sep 26, 2022
Git Explorer: cross-platform git workflow improvement tool inspired by Magit

Gex Git workflow improvement CLI tool inspired by Magit. This project is still under initial development, but I am actively dogfooding it and features

Peter Hebden 204 Jan 6, 2023
Native cross-platform full feature terminal-based sequence editor for git interactive rebase.

Native cross-platform full feature terminal-based sequence editor for git interactive rebase.

Tim Oram 1.2k Jan 2, 2023
Print your git contributions in your terminal, blazingly fast

Takoyaki Blazingly fast git contribution graph in your terminal Features ✔️ Customizable ✔️ Plugins to support a bunch of cloud based git repositories

kyeboard 13 Feb 6, 2023
A structure editor for a simple functional programming language, with Vim-like shortcuts and commands.

dilim A structure editor for a simple functional programming language, with Vim-like shortcuts and commands. Written in Rust, using the Yew framework,

Joomy Korkut 6 Nov 18, 2022
A simple and efficient terminal UI implementation with ratatui.rs for getting quick insights from csv files right on the terminal

CSV-GREP csv-grep is an intuitive TUI application writting with ratatui.rs for reading, viewing and quickly analysing csv files right on the terminal.

Anthony Ezeabasili 16 Mar 10, 2024
A super simple prompt for Fish shell, just shows git info and Vi mode.

vifi is a portmandeau of 'Vi' and 'Fish', because it's a prompt for Fish shell, primarily focused around showing proper indicators when using Vi key bindings.

Mat Jones 1 Sep 15, 2022
A simple, TUI git management tool

Gitten Gitten is git project manager with multiple repositories. With gitten you can check out to new branches and tag branches from you active. Prere

Hamza Oral 12 Mar 31, 2023
Turn static CLI commands into TUIs with ease

lazycli Turn static CLI commands into TUIs with ease Demo: Usage Pick a command that spits out either a list or table of content, like ls, docker ps,

Jesse Duffield 255 Dec 20, 2022
🐢 Atuin replaces your existing shell history with a SQLite database, and records additional context for your commands

Atuin replaces your existing shell history with a SQLite database, and records additional context for your commands. Additionally, it provides optional and fully encrypted synchronisation of your history between machines, via an Atuin server.

Ellie Huxtable 4.6k Jan 1, 2023
🤖 just is a handy way to save and run project-specific commands.

just just is a handy way to save and run project-specific commands. (非官方中文文档,这里,快看过来!) Commands, called recipes, are stored in a file called justfile

Casey Rodarmor 8.2k Jan 5, 2023
1 library and 2 binary crates to run SSH/SCP commands on a "mass" of hosts in parallel

massh 1 library and 2 binary crates to run SSH/SCP commands on a "mass" of hosts in parallel. The binary crates are CLI and GUI "frontends" for the li

null 2 Oct 16, 2022
Save cli commands and fuzzy find them later

crow - cli command memorizer What is crow? | Installation | Usage | FAQ What is crow? crow (command row) is a CLI tool to help you memorize CLI comman

sandstorm 7 Feb 17, 2022
koyo is a cli tool that lets you run commands as another user. It is similar to doas or sudo.

koyo is a cli tool that lets you run commands as another user. It is similar to doas or sudo.

null 3 Nov 27, 2021
Tldr - 📚 Collaborative cheatsheets for console commands

What is tldr-pages? The tldr-pages project is a collection of community-maintained help pages for command-line tools, that aims to be a simpler, more

tldr pages 42.4k Dec 29, 2022