Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

gitmux

> 开发工具
Open source

:computer: Git in your tmux status bar

791 stars0 likes0 views
WebsiteGitHub

About

:computer: Git in your tmux status bar

Gitmux shows git status in your tmux status bar

  • easy: install and forget
  • minimal: shows what you need, when you need it
  • discrete: shows nothing when you're not in a git-managed directory
  • shell-agnostic: doesn't rely on any shell-specific features, so will work with all of them
  • customizable: colors, symbols and layout are all configurable

  • Prerequisites
  • Installing
    • Binary release
    • Homebrew (macOS and linux) (amd64 and arm64)
    • AUR
    • From source
  • Getting started
    • Command line interface
  • Customizing
    • Symbols
    • Styles
    • Layout components
    • Additional options
  • Troubleshooting
    • Gitmux takes too long to refresh?
  • Contributing
  • License: MIT

Prerequisites

Works with all reasonably recent tmux versions (2.1+)

Installing

Binary release

Download the latest binary for your platform/architecture and uncompress it.

Homebrew (macOS and linux) (amd64 and arm64)

Install the latest version with:

bash
brew install gitmux

AUR

Arch Linux users can download the gitmux, gitmux-bin or gitmux-git AUR package.

From source

Download and install a Go compiler (Go 1.16 or later). Run go install to build and install gitmux:

go install github.com/arl/gitmux@latest

Getting started

If your tmux version supports pane_current_path (tmux v2.1+), just add this line to your .tmux.conf:

set -g status-right '#(gitmux "#{pane_current_path}")'

If your tmux doesn't support pane_current_path then you can use a bash-specific solution to achieve relatively similar behaviour: gitmux will refresh after every shell command you run or when you switch windows, however it won't refresh automatically, nor when switching panes.

Note that tmux v2.1 was released in 2015 so you're probably better off updating to a more recent version anyway .

Command line interface

gitmux is not meant to be call directly but it still has a command line interface that can be used to create the default configuration, troubleshoot your installation or during development:

$ gitmux -h
gitmux v0.11.5
Usage: gitmux [options] [dir]

gitmux prints the status of a Git working tree as a tmux format string.
If directory is not given, it default to the working directory.

Options:
  -cfg FILE       read gitmux config from FILE.
  -printcfg       prints default configuration file.
  -dbg            outputs Git status as JSON and print errors.
  -timeout DUR    exits if still running after given duration (ex: 2s, 500ms).
  -V              prints gitmux version and exits.

Customizing

gitmux output can be customized via a configuration file in YAML format.

This is the default gitmux configuration file, in YAML format:

…

First, save the default configuration to a new file:

gitmux -printcfg > $HOME/.gitmux.conf

Modify the line you've added to .tmux.conf, passing the path of the configuration file as argument to gitmux via the -cfg flag

set -g status-right '#(gitmux -cfg $HOME/.gitmux.conf "#{pane_current_path}")'

Open .gitmux.conf and modify it, replacing symbols, styles and layout to suit your needs.

In tmux status bar, gitmux output immediately reflects the changes you make to the configuration.

gitmux configuration is split into 4 sections:

  • symbols: they're just strings of unicode characters
  • styles: tmux format strings
  • layout: list of gitmux layout components, defines the component to show and in their order.
  • options: additional configuration options

Symbols

The symbols section defines the symbols printed before specific elements of Git status displayed in tmux status string:

…

Styles

Styles are tmux format strings used to specify text colors and attributes of Git status elements. See the STYLES section of tmux man page.

…

Layout components

The layout section defines what components gitmux shows and the order in which they appear on tmux status bar.

For example, the default gitmux layout shows is:

yaml
layout: [branch, .., remote-branch, divergence, " - ", flags]

It shows, in that order:

  • the local branch name,
  • 2 dots characters ..,
  • the remote branch name
  • the local/remote divergence
  • a - character
  • and finally the flags representing the working tree state

Note that elements only appear when they make sense, for example if local and remote branch are aligned, the divergence string won't show up. Same thing for the remote branch, etc.

But you can anyway choose to never show some components if you wish, or to present them in a different order.

This is the list of the possible keywords for layout:

Layout keywords Description Example
branch local branch name main
remote-branch remote branch name origin/main
divergence divergence local/remote branch, if any ↓·2↑·1
remote alias for remote-branch followed by divergence origin/main ↓·2↑·1
flags Symbols representing the working tree state ✚ 1 ⚑ 1 … 2
stats Insertions/deletions (lines). Disabled by default Σ56 Δ21
any string foo Non-keywords are shown as-is hello gitmux

Some example layouts:

  • default layout:
yaml
layout: [branch, .., remote-branch, divergence, " - ", flags]
  • some examples layouts:
yaml
layout: [branch, divergence, " - ", flags]
yaml
layout: [flags, " ", branch]
yaml
layout: [branch, "|", flags, "|", stats]

Additional options

This is the list of additional configuration options:

Option Description Default
branch_max_len Maximum displayed length for local and remote branch names 0 (no limit)
branch_trim Trim left, right or from the center of the branch (right, left or center) right (trailing)
ellipsis Character to show branch name has been truncated …
hide_clean Hides the clean flag entirely false
swap_divergence Swaps order of behind & ahead upstream counts false
divergence_space Add a space between behind & ahead upstream counts false
flags_without_count Show flags symbols without counts* false

*When flags_without_count is true, shows only symbols (empty symbols show nothing). When false (default), shows symbols with counts (empty symbols show counts only).

Troubleshooting

Check the opened and closed issues and don't hesitate to report anything by filing a new one.

Gitmux takes too long to refresh?

In case gitmux takes too long to refresh, try to decrease the value of the status-interval option. A reasonable value is 2 seconds, which you can set in .tmux.conf with:

set -g status-interval 2

Check out tmux man page for more details.

Contributing

Pull requests are welcome.
For major changes, please open an issue first to open a discussion.

License: MIT

Issues· 9 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Gobashclifishgit

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具