Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akiomik/git-branch-status
A command line tool for displaying git branch colored by status
https://github.com/akiomik/git-branch-status
cli git git-branch git-status prompt rust vcs-information zsh
Last synced: about 1 month ago
JSON representation
A command line tool for displaying git branch colored by status
- Host: GitHub
- URL: https://github.com/akiomik/git-branch-status
- Owner: akiomik
- License: apache-2.0
- Created: 2021-08-31T12:34:47.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-07T05:51:32.000Z (about 2 months ago)
- Last Synced: 2024-12-07T06:27:25.941Z (about 2 months ago)
- Topics: cli, git, git-branch, git-status, prompt, rust, vcs-information, zsh
- Language: Rust
- Homepage:
- Size: 524 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# git-branch-status
A command line tool for displaying git branch colored by status, like zsh's [vcs_info](https://zsh.sourceforge.io/Doc/Release/User-Contributions.html#Version-Control-Information).
![screenshot](screenshot.png?raw=true)
## Installation
```sh
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`:
```sh
# ~/.zshrc
setopt prompt_subst
RPROMPT='$(git branch-status --mode zsh)'
```### Zsh with Starship 🚀
Add the following to `~/.config/starship.toml`:
```sh
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).
```sh
❯ ./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: 2029msRun './target/release/git-branch-status --mode zsh' 100 times
....................................................................................................done!
Elapsed time: 404ms
```