DEV Community

Cover image for I Built a TUI to Replace `git commit` (and it's written in Go)
Zayan Mohamed
Zayan Mohamed

Posted on

I Built a TUI to Replace `git commit` (and it's written in Go)

We have all been there. You've been coding for three hours, you finally get the build to pass, and you just want to save your work. You type:

git commit -m "updates"

Enter fullscreen mode Exit fullscreen mode

...and immediately regret it. Or maybe you're pair programming and need to add a Co-authored-by trailer, but you can never remember if the email goes in angle brackets or parentheses.

I built GitWizard (gitwiz) to solve this. It’s a secure, interactive CLI tool written in Go that replaces the standard git commit flow with a beautiful Terminal UI (TUI).

Why build another Git tool?

There are plenty of git helpers out there, but I wanted something that hit three specific criteria:

  1. Security First: Many CLI wrappers are vulnerable to command injection. I wanted something that uses strict exec.Command handling without shell concatenation.
  2. Native Feel: It needed to feel like a modern part of the terminal ecosystem, not a clunky script.
  3. Context Aware: It should know who I've been coding with and what issues I'm working on.

The Tech Stack: Go + Charm

I chose Go for this project because I wanted a fast, static binary that could run anywhere without complex dependencies.

For the UI, I used the incredible libraries from Charm:

  • Bubble Tea: For the Elm-inspired TUI framework.
  • Huh: For the form inputs.

Using these libraries allowed me to create a "Wizard" that guides you through the commit process step-by-step, validating your input in real-time.

Features at a Glance

1. Interactive Context Wizard

Instead of remembering flags, gitwiz asks you for what matters. It enforces subject line length limits automatically so your git log stays readable.

2. Auto-Detect Co-Authors

This is my favorite feature. gitwiz scrapes your recent git history to find people you've collaborated with. When you reach the "Co-Authors" step, you get a selectable list of your actual teammates. No more copy-pasting names and emails.

3. Smart Issue Linking

If your branch is named feat/123-user-auth, the tool automatically suggests linking to Issue #123. It also scans your clipboard for potential references.

4. Security

As developers, we often blindly trust CLI tools. I designed gitwiz to be paranoid. It strips control characters to prevent terminal corruption and sanitizes all inputs to prevent argument injection.

How it works (The Architecture)

The architecture is kept simple to ensure maintainability:

  • internal/git: Handles all git operations safely. It wraps os/exec to ensure we never pass user input to a shell interpreter.
  • internal/tui: Contains the Bubble Tea models and Huh forms.
  • internal/logic: Handles the business logic of formatting trailers (like Fixes: #123) according to Git standards.

Give it a Try

If you have Go installed, you can grab it right now:

go install github.com/Zayan-Mohamed/gitwiz@latest

Enter fullscreen mode Exit fullscreen mode

Or, if you prefer binaries, I have releases for Linux and macOS on the GitHub Releases page.

Once installed, just stage your files and run:

gitwiz

Enter fullscreen mode Exit fullscreen mode

Contributing

This is an open-source project, and I'd love to see it grow. If you're looking to contribute to a Go project, I'm currently looking for help with:

  • Adding custom trailer configurations (e.g., Reviewed-by).
  • Improving the co-author scraping logic.

Check out the repo here:

GitHub logo Zayan-Mohamed / gitwiz

🧙 Interactive Git commit wizard with smart metadata trailers. Compose better commit messages with TUI-guided co-authors, issue references, and conventional commits. Built with Go + Charm.

GitWizard 🧙

Go Version Release License Build Status Go Report Card Security

A secure, user-friendly CLI tool that replaces git commit with an interactive commit context wizard.

✨ Features

  • Interactive TUI - Beautiful terminal UI powered by Charm's Huh
  • Co-Author Detection - Automatically scrapes recent contributors from git history
  • Smart Issue Linking - Extracts issue references from branch names
  • Clipboard Integration - Suggests references from clipboard
  • Security First - Built with command injection prevention
  • Git Trailer Support - Generates properly formatted trailers for GitHub/GitLab

📦 Installation

Using Go Install

go install github.com/Zayan-Mohamed/gitwiz@latest
Enter fullscreen mode Exit fullscreen mode

Download Binary

Download the latest binary from releases:

# Linux
wget https://github.com/Zayan-Mohamed/gitwiz/releases/latest/download/gitwiz-linux-amd64.tar.gz
tar -xzf gitwiz-linux-amd64.tar.gz && chmod +x gitwiz-linux-amd64.tar.gz
sudo mv gitwiz-linux-amd64 /usr/local/bin/gitwiz

# macOS
wget https://github.com/Zayan-Mohamed/gitwiz/releases/latest/download/gitwiz-darwin-amd64.tar.gz
tar -xzf gitwiz-darwin-amd64.tar.gz && chmod +x gitwiz-darwin-amd64.tar.gz
sudo mv gitwiz-darwin-amd64 /usr/local/bin/gitwiz
Enter fullscreen mode Exit fullscreen mode

Build from Source

git clone https://github.com/Zayan-Mohamed/gitwiz.git
cd gitwiz
go build -o gitwiz
sudo mv gitwiz /usr/local/bin/
Enter fullscreen mode Exit fullscreen mode

Using Installation Script

./install.sh
Enter fullscreen mode Exit fullscreen mode

Usage

Instead of running git commit, simply run:

Enter fullscreen mode Exit fullscreen mode

Let me know what you think in the comments! Happy committing. 🧙‍♂️

Top comments (0)