Terminal UI options for Git

Several interesting projects:

Have not tried them yet, but trying to get some less technical people using Git, so these may help.

Comparison of the three options:

The above article contains an interesting table that shows the differences between tools written in Rust (gitui), Go (lazygit), and C (tig):

While implementation matters as well as language, this probably represents what we typically see for binary size.

In my own testing, I like gitui pretty well. It seems like a nice replacement for git add --interactive where you can easily stage chunks of a file for commit. tig has a nice default view which shows all branch paths and merges – similar to gitk.

For new users, it seems gitui is the most intuitive because it does not require memorizing a bunch of keyboard shortcuts. I plan to try it over the next week in my own development and see how it goes.

It is interesting that the gitui binary (Rust) is completely static – from the name of the download binary, I assume it is statically linked to musl – looking at the CD config, that appears correct.

The Go binary likely could have also been made completely static if the build process had turned off CGO.

[cbrake@mars ~]$ ldd /usr/bin/lazygit 
        linux-vdso.so.1 (0x00007fff7bbd4000)
        libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007f962fe86000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f962fcbd000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007f962fefd000)

[cbrake@mars ~]$ ldd /usr/local/bin/gitui 
        not a dynamic executable

[cbrake@mars ~]$ ldd /usr/bin/tig
        linux-vdso.so.1 (0x00007fffe0dbd000)
        libreadline.so.8 => /usr/lib/libreadline.so.8 (0x00007ff6114f3000)
        libncursesw.so.6 => /usr/lib/libncursesw.so.6 (0x00007ff611482000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007ff6112b9000)
        /lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x00007ff611647000)

I kind of fizzled out on this until I recently integrated LazyVIM into my editor, which includes LazyGit integration. LazyGit is quite nice – very fast and quick to do things and keyboard shortcuts are fairly obvious. I’ve tried vim-fugitive, but it never quite clicked with me – always found myself reverting to Git command line. We’ll see if LazyGit is different …

LazyGit seems to be a more active project than GitUI.

Below is a screenshot:

Note, for this to work, you need to install LazyGit separately.

1 Like

I’ve been using lazygit for a while now and its solid!
There have been some updates over the last 6 months which improved the keybindings and menu system as well.

1 Like

This is an amazing write-up on lazygit – I learned a lot from it. Should be spending more time in the lazygit docs …

Quickly opening a modified file using LazyGit

If you have a large source tree and want to quickly edit a file you recently modified, fire up LazyGit, select file and hit e. Super fast. Especially in Yocto trees, it is hard to remember the name of the file you are working on as there are so many. You can even select files from past commits (although the current file is edited).