git-branch-status 0.1.0

A command line tool for displaying git branch colored by status
Documentation
  • Coverage
  • 0%
    0 out of 14 items documented0 out of 7 items with examples
  • Size
  • Source code size: 430.76 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 395.38 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 16s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • akiomik

git-branch-status

A command line tool for displaying git branch colored by status, like zsh's vcs_info.

screenshot

Installation

git clone https://github.com/akiomik/git-branch-status.git && cd git-branch-status
cargo build --release
cp target/release/git-branch-status ~/bin

Usage

Zsh

Add the following to ~/.zshrc:

# ~/.zshrc
setopt prompt_subst
RPROMPT='$(git branch-status --mode zsh)'

Zsh with Starship 🚀

Add the following to ~/.config/starship.toml:

format = """
$directory\
$custom\
$line_break\
$character"""

[custom.branchstatus]
command = "git branch-status --mode zsh"
when = "[[ -d .git ]] || [[ `git rev-parse --git-dir > /dev/null 2>&1; echo $?` -eq 0 ]]"
format = " on $output"

Benchmark

Run ./scripts/bench.sh. git-branch-status is about 5x faster than vcs_info on M1 MacBook Pro (2021).

 ./scripts/bench.sh
Setup vcs_info...done!
Setup git-branch-status...done!

Run 'vcs_info; echo $vcs_info_msg_0_' 100 times
....................................................................................................done!
Elapsed time: 2029ms

Run './target/release/git-branch-status --mode zsh' 100 times
....................................................................................................done!
Elapsed time: 404ms