DEV Community

lef237
lef237

Posted on • Edited on

Use gst to safely get an overview of all git states

Checking changed files with git status, looking at history with git log, checking diffs with git diff...

When you repeatedly jump back and forth between these commands while working, you sometimes start thinking, “It would be nice if I could see all the information I want right now in one place.”

So I created gst, a CLI tool that lets you check the state of a Git repository at a glance.

Why I built it

I was teaching Git to an acquaintance who had just started programming, and they said things like:

I don’t really understand git status

It’s hard to remember so many different commands

I’ve heard of tools like lazygit, but I’m scared I might accidentally change the repository state

That made me think: why not build a tool that solves those problems?

That was the starting point for this project.

What You Can See

When you launch gst, you can view your current branch, differences from remote repositories, modified files, staged changes, working directory diffs, stashes, and the commit graph—all from your terminal.

gst overview

Demo video

A picture is worth a thousand words, so we have also prepared a video demonstration.

Watching it will give you a better sense of how gst works in practice and why it can be useful.

Installation

There are two ways to install it.

If you use Go, run:

go install github.com/lef237/gst/cmd/gst@latest
Enter fullscreen mode Exit fullscreen mode

It also supports Homebrew. You can install it with:

brew install lef237/tap/gst
Enter fullscreen mode Exit fullscreen mode

Usage

Normally, run the following command inside a repository:

gst
Enter fullscreen mode Exit fullscreen mode

If you want to display the information once and then exit, use --once:

gst --once
Enter fullscreen mode Exit fullscreen mode

In the TUI, you can move between views using the Tab key and arrow keys.

Press r to reload, and q to quit.

Read-Only

gst is a tool for checking the state of a repository.

It does not perform operations that modify the repository state, such as push, pull, checkout, commit, merge, or rebase.

Even if you are not very familiar with Git, there is less risk of accidentally changing something, so I think it is easy to use as a tool for checking repository status.

Diff display

In Git, staged changes and unstaged changes in the working tree are managed separately.

In gst, changed files are displayed with markers such as INDEX, WORKTREE, NEW, and CONFLICT.

This makes it easier to understand which files are staged and which files still only have changes in the working tree.

In the diff view, you can switch between the working tree diff and the staged diff.

This is useful when you want to check what will be included in the next commit, or when you want to organize your changes before splitting them into separate commits.

Copying diffs

In the diff view, you can copy the current diff directly to the clipboard.

yank diff from gst

Press y to copy working directory diffs, and i to copy staged diffs.

Pressing a copies a patch that includes all changes from HEAD to the current working directory.

The copied content is in patch format, so it can be applied with git apply.

I think this is very useful!

Summary

gst is not a tool intended to replace Git operations.

Rather, it is a tool for checking “what state is this repository in right now?” before you perform an operation.

Please give it a try :)

GitHub logo lef237 / gst

Read-only Git status visualizer

gst

gst is a read-only Git status visualizer for people who want to understand the shape of a repository before they run Git commands.

Image

Demo: https://youtu.be/EMO3DaNkqT0

Motivation

Git beginners often struggle because the current state is split across several places:

  • commits and branches form a graph
  • local branches and remote tracking branches can point at different commits
  • the index and working tree can each contain different file changes

gst puts those pieces into one terminal dashboard. It does not push, pull checkout, commit, merge, rebase, or mutate the repository.

Install

go install github.com/lef237/gst/cmd/gst@latest
Enter fullscreen mode Exit fullscreen mode

Or with Homebrew:

brew install lef237/tap/gst
Enter fullscreen mode Exit fullscreen mode

For local development:

go run ./cmd/gst
Enter fullscreen mode Exit fullscreen mode

To build a local binary:

go build -o tmp/gst ./cmd/gst
Enter fullscreen mode Exit fullscreen mode

Release steps are documented in docs/release.md.

Usage

gst
gst --interval 1s
gst --once
gst --no-color
Enter fullscreen mode Exit fullscreen mode

By default, gst opens the interactive TUI.

Interactive controls:

  • Move between views with tab, the left/right arrow keys…

Top comments (0)