GIT Tools (v4.0.0+)

License

This is the Go rewrite of gittool, starting from v4.0.0. For the older Java-based version (v3.x and earlier), see github.com/morimekta/gittool.

gittool is a small collection of helper programs to streamline my git usage. The main utility is gt, which wraps some git commands in an interactive interface, and makes a bit more powerful diff utility using gvim.

Extra git tools by morimekta

Usage:
  gt [command]

Available Commands:
  branch      Change branch interactively
  diff        Diff changes
  help        Help about any command
  log         Log changes
  status      Review branch status

Flags:
      --git-repository string   The git repository root directory
  -h, --help                    help for gt
      --verbose                 Show verbose output
  -v, --version                 version for gt

Install

Requires Go 1.26.1+.

go install gitlab.com/morimekta/gittool-go/v4/gt@latest

Or build from source:

make build
sudo cp gt /usr/local/bin/

Or build and install as a .deb package:

make deb
sudo dpkg -i build/gittool-*.deb

The .deb installs gt to /usr/local/bin/ and supporting files (including diffall.vim) to /usr/local/share/gittool/.

Commands

branch (br, b)

Interactive branch management. Displays branches with commit counts relative to the diff base, remote tracking status, and uncommitted changes marker.

Key bindings in the selection: - <enter>: Check out branch - m: Move (rename) branch - b: Set diff base for the branch - B: Set remote diff base - D: Delete selected branch - n: Create new branch - q: Exit to console

status (st)

Review branch status, showing commits since the diff base and any staged or unstaged changes.

gt status [-b branch] [-r]

diff (d)

Opens a visual diff in gvim comparing the current branch against its diff base (or a specified branch), including staged and unstaged changes. Uses the diffall.vim script to open each file pair in a separate tab with a vertical diff split.

gt diff [-b branch] [-g geometry] [paths...]
  • -b branch: Compare against a specific branch instead of the diff base.
  • -g geometry: Set gvim window geometry (default 260x50).
  • paths...: Restrict the diff to specific files or directories. When a directory is given, only files with actual diffs within it are shown. When a file is given that has no diff, it opens a static comparison of the committed version vs the working copy.

log (l)

Show commit log between the current branch and its diff base.

gt log [-b branch] [-l] [-r] [-R]

Configuration

gittool stores per-branch configuration in the git config:

  • default.branch - Override default branch detection (otherwise auto-detects master/develop/main)
  • branch.<name>.diffbase - Custom diff base for a branch (defaults to the default branch)

Release

VERSION="v1.0.0"
git tag "$VERSION"
make build