<h1 align="center">
<a href="https://prompts.chat">
... is swankier than thou. Yabagi displays git repository status in your bash prompt.
Sign in to like and favorite skills
... is swankier than thou. Yabagi displays git repository status in your bash prompt.
Use it and you'll ask yourself how you've ever managed without it. At the time that I started building this tool, there were similar projects out there. But I found them either overly complicated or lacking in features. So I used those tools as a starting point and built this tool. After having used and tweaked it for over four years now, it has become it's own type of beasty. This is what it can look like:

Try it. You'll like it.
source /path/to/script/yabagi-prompt.sh
Some notable features of this tool:
NOTE:
[remote "origin"] url = https://github.com/someproject/someproject.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master [remote "myremote"] url = [email protected]:myusername/someproject-my-fork.git fetch = +refs/heads/*:refs/remotes/myremote/* [branch "normalbranch"] remote = myremote merge = refs/heads/normalbranch [branch "weirdbranch"] remote = [email protected]:myusername/someproject-my-fork.git merge = refs/heads/weirdbranch
A test script is supplied in the 'test' directory. Its purpose is to execute a semi-automatic test of yabagi-prompt with several git versions. It generates output that needs further manual inspection detect any weirdness. The tests require docker to be up and running. First run test/build-images.sh to build the docker images. Then run test/run-test.sh to test yabagi with the different git versions.
Although yabagi will work just fine, straight out of the box, you can tweak it if you want to. Yabagi's look and some behavior can be controlled by directly editing Yabagi's code or by placing a yabagi.conf file in your homedir. An external config file has the added benefit of keeping your customization in tact. All configurables are demonstrated in the supplied example config file.
The following table lists a few non style related configurables, that can be modified in your shell to control the behavior of yabagi.
| Variable | default | Info |
|---|---|---|
| yabEnable | 1 | When false, yabagi will not process any git information on the prompt. This also disables background fetching. Useful for debugging. |
| yabTraceMute | 1 | When false and you do 'set -x' in you shell, you can see what yabagi is actually doing. By default yabagi will mute the output of itself, to prevent from clobbering your terminal. Useful for debugging. |
| yabResolveTag | 1 | When true, yabagi will always try to resolve commit hashes to tags. If a commit has multiple tags, it will use whatever tag git suggests, or if git suggests using a commit hash, then the first tag found for that commit will be shown. When false, yabagi will display exactly what 'git-branch -vv' shows, which varies depending on how and what you've checked out the current commit. |
| yabSetWindowTitle | 1 | When true, yabagi will insert a string into the prompt, that will set the title of your terminal window. |
| yabFetchInterval | 15 | Interval in minutes to check remote git repos for updates. Set to 0 to disable checking. |
| yabFetchTimeout | 2 | Interval in minutes to retry a fetch if it failed. Set to 0 to disable timeout. |
| yabFetchWait | 0 | Maximum amount of seconds to wait for sync to complete. Set to 0 to not wait, ie. do a background fetch. |
| Prompt | Explanation |
|---|---|
| ✓ [master!] /tmp/myrepo $ | On git repo, master branch, ahead/behind status not yet known, no changes |
| ✓ [master ↑1↓2] /tmp/myrepo $ | On git repo, master branch, Ahead by 1 commit, Behind by 2 commits, no changes |
| ✓ [master ●2+1?3] /tmp/myrepo $ | On master branch, two staged files, one modified unstaged file, three untracked files |
| ✓ [master L ⊗1] /tmp/myrepo-local-only $ | On a local-only repo, master branch, one pending conflict |
| ✓ [2364a201a3 D ≡1] /tmp/myrepo $ | On detached HEAD, One session stashed |
| ✓ [imadolphin D] /tmp/myrepo $ | On detached HEAD, on tag 'imadolphin' |
| ✓ [<bare>] /tmp/myrepo-bare $ | On a bare repo |
| ✓ [<empty>] /tmp/myrepo $ | On an empty local repo |
| ✓ /var/log $ | Not on a git repo, Exit status good/0 |
| ✘ 128 /var/log $ | Not on a git repo, Exit status bad/128 |
| Symbol | Explanation |
|---|---|
| staged files |
| changed but unstaged files |
| untracked files |
| stash entries |
| files with merge conflicts |
| Symbol | Explanation |
|---|---|
| ahead of remote by commits |
| behind remote by commits |
| on detached HEAD |
| local branch or repo, no remote configured |
| ahead / behind status is unknown and a background 'git fetch' has been started to get that information |
| ahead / behind status is unknown, and will not be known because unnamed remote was detected, which git does not really support |
| Empty repository, with no commits |
| Bare repository |
This project was inspired by, and borrowed some code from, the following projects: