GitUI - a git terminal UI

Posted by on 2 September 2022

I've tried various git UI's over the years but I always end up right back with the cli tool. I've been learning Rust and as a result I like to find tools that have been written in Rust because I know they'll be memory safe and generally always pretty fast. Recently I ran across a tool called GitUI which is a terminal based UI frontend for git.

The git cli tool will do absolutely everything you need it to, but sometimes it would be nice to just mindless maneuver around without having to remember the exact syntax for what you want to do, or maybe you just want to quickly look around. Having a UI that you can navigate with a few hot-keys would really be nice. There are certainly several UIs that already do this quite well but if you're like me and you live in the terminal all day, then it would be nice to have a tool that you can run right where you are, possibly it lives in a tmux window or something.

GitUI is not a complete replacement for the git cli tool. I did not see a way to do merge or rebase for example but if you want to view logs, view diffs, make commits, amend changes and manage stashes GitUI will do that and more all without having to remember the syntax for each task. It also feels very lightweight and its very fast. GitUI has five tabs along the top, status, logs, files, stashing and stashes. I'll describe each below.

Status

I'll use the emacs-ng public git repo for demonstration purposes. The status pane will show any unstaged files you may have created as well as any files that you might have changed, essentially what you would get with git status. My first disappointment came when I realized there are no vim bindings. It would have been really nice to be able to move around with the hjkl keys, but alas you have move all the way down to the arrow keys :(. That said there is a lot you can do from this tab. You can view diffs, stage and unstage files, reset hunks, push, pull, edit, blame, and view history. To navigate from one tab to the next you can either hit the number corresponding to the tab, or use <tab> and <shift-tab> to go back and forth. There are a list of hotkeys displayed along the bottom that tell you what you can do on each tab. The one thing I don't like is the commit message. Unless I'm missing something you can only enter a single line. That said it will let you drop to an editor and you can obviously enter multiple lines there.

Logs

The logs view obviously shows you the list of commits that have been made. This is where you can choose which hash you want to learn more about, hit <enter> and see more details. You can also manage branches and tags from this tab, and probably one of most favorite is just hitting <y> copies the hash into your clipboard! The hotkey <shift-f> will show you the list of files that were involved in the commit you have selected. You can also revert a commit by selecting and using the hotkey <shift-d>.

Files

The files tab shows a list of files associated with the repository and it honors .gitignore so anything in there won't show up in the list. From here you can find, but sadly it only matches filenames, it does not use git grep. Other things you can do here is edit the file, although not in this UI, it uses whatever editor you have in your EDITOR environment variable. You can also view the history of a file or run blame.

Stashing

The stashing tab is where you can create a stash. You can also see history and blame.

Stashes

The stashes tab differs from stashing in that you get a list of stashes already created that you can unstash. You can easily inspect the stashes which is a nice touch so you can see whats in it in case you forget which I often do.

Summary

GitUI is a really nice tool that I'll be adding to my toolbox. I can't say that I'll be using it in my everyday workflow but occasionally it will be nice to be able to navigate around while researching something or managing stashes. While there are a couple features missing that I've pointed out, most of them appear to at least be on the roadmap such as log search, and rebase. If you live in the command line like I do give this tool a try and let me know what you think.

Tags: #git

Categories: #technology

Tags

Categories