Skip to content

About

Beautiful themes, autosuggestions & syntax highlighting for Git Bash on Windows. Oh My Zsh-style setup in one command: no WSL, no admin, fully undoable.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

66 Commits

Folders and files

Repository files navigation

oh-my-gitbash

Make Git Bash beautiful and smart: 7 themes, autosuggestions, syntax highlighting, fuzzy history. One command. No WSL, no admin.

oh-my-gitbash sets up Git Bash on Windows with a themed, fast prompt, zsh plugins and matching terminal colours, and puts everything back with one command if you change your mind.

gitbash.akadeepesh.com: see every theme live, try the features, compare the benchmarks.

Install, then switching themes with omg theme set

curl -fsSL https://raw.githubusercontent.com/akadeepesh/oh-my-gitbash/main/install.sh | bash

Run it in Git Bash. You get zsh with autosuggestions, syntax highlighting, completion, shared history, prefix search on ↑/↓, z jumping and Ctrl+R fuzzy history, plus a theme applied to the prompt, Windows Terminal and the Git Bash window at once. No admin rights, and nothing written into the Git for Windows folder.

Want to see every change first? Add --dry-run:

curl -fsSL https://raw.githubusercontent.com/akadeepesh/oh-my-gitbash/main/install.sh | bash -s -- --dry-run

Is this safe?

Backups Before a file is changed the first time, an exact copy goes to ~/.oh-my-gitbash/backups/<time>/, with a manifest.tsv listing each file and its sha256.
Dry run --dry-run prints a diff of every file it would change and every download it would make, and changes nothing. The test suite checks this by comparing checksums of every file.
Uninstall omg uninstall removes our blocks and puts every file back. If you haven't edited a file since, you get the original bytes back (the tests check sha256 equality). If you have, your edits stay and only our block goes. --purge also deletes the backups.
Your files Never overwritten. We only add marked blocks (# >>> oh-my-gitbash >>> … # <<< oh-my-gitbash <<<). Running the installer twice changes nothing the second time.
Windows Terminal settings.json keeps its comments and formatting. We add one profile, Git Bash (oh-my-gitbash), and one colour scheme, inside /* oh-my-gitbash */ markers. Your default profile is not changed. The file is validated before and after writing, and put back if anything is off.
Admin / registry None, except: if you agree to install the Nerd Font, it's registered for your user under HKCU\…\Fonts, which is what right-click › Install does. It always asks first.
Downloads Everything is pinned and checked: zsh from repo.msys2.org (sha256), plugins by git commit, starship and the font by sha256, and only if you don't already have them.

What it touches:

Path Change
~/.oh-my-gitbash/ everything we install: zsh, plugins, our scripts, caches, backups
~/.bashrc a block at the top: hands over to zsh (or loads bash lite mode)
~/.bash_profile a block that loads ~/.bashrc, only if nothing does yet
~/.zshrc, ~/.zshenv a block each (zsh mode only)
~/.inputrc a block: prefix history search, case-insensitive completion (bash)
~/.minttyrc a block at the bottom: theme colours and font for the Git Bash window
Windows Terminal settings.json one profile and one scheme, in marked regions (skip with --no-wt)
%LOCALAPPDATA%\Microsoft\Windows\Fonts JetBrainsMono Nerd Font, only if you said yes (skip with --no-font)

Not touched: the Git for Windows folder, system PATH, ~/.config/starship.toml, any other terminal profile.

Options

--shell zsh|bash   zsh (default), or stay on bash with "lite mode" (same prompt, keys and history)
--theme NAME       soft-pills (default), latte, minimal, rose-pine, pastel, gruvbox-blocks, nord-frost
--no-font          don't offer to install a Nerd Font
--no-wt            don't touch Windows Terminal
--dry-run          show every change, make none
--yes              answer yes to the questions (font, starship download)

Commands

omg theme list            themes, with colour swatches
omg theme set pastel      switch prompt, Windows Terminal and Git Bash window together
omg theme preview pastel  try one in this shell only
omg doctor                check font, PATH, startup time, Windows Terminal settings, zsh
omg repair                re-apply your settings (e.g. after a Git for Windows update)
omg update                get the latest version and re-apply
omg uninstall             put everything back
omg bench                 measure startup and prompt speed on your machine

Fastest Git Bash prompt

Every number below was measured on one machine through a real pseudo-terminal: the time until you can type, and the time from Enter until the next prompt is drawn. Medians. Method, caveats and full results: bench/RESULTS.md. Run omg bench to measure your own machine.

setup ready to type prompt: empty folder prompt: small repo (425 files) prompt: vscode (21,887 files)
bash: Git for Windows default 279 ms 91 ms 143 ms 149 ms
bash: Starship (starship init bash) 473 ms 84 ms 183 ms 507 ms
bash: Oh My Posh 357 ms 117 ms 182 ms 463 ms
bash: oh-my-gitbash lite mode 238 ms 76 ms 172 ms 110 ms
zsh: Starship (starship init zsh) + plugins 201 ms 73 ms 141 ms 374 ms
zsh: Oh My Zsh default 259 ms 49 ms 52 ms 62 ms
zsh: Powerlevel10k + plugins 260 ms ¹ 44 ms 47 ms 177 ms
zsh: Oh My Zsh + Powerlevel10k 468 ms ¹ 60 ms 85 ms 67 ms
zsh: oh-my-gitbash 149 ms 47 ms 122 ms 77 ms ²

¹ p10k's instant prompt shows a prompt after ~68 ms; this is when it accepts input. ² Big-repo mode: branch without status after the first slow prompt. With it off: 356 ms.

Honest summary: oh-my-gitbash starts fastest and stays fast in big repos. Powerlevel10k draws git prompts faster in mid-size repos (its gitstatusd daemon); part of our 122 ms there is the theme's language pill running node --version in a JavaScript repo. Oh My Zsh's default theme is cheap per prompt because it shows little.

Why most setups are slow on Git Bash: MSYS emulates fork() on Windows, so every $(…) costs ~9 ms and every program started costs 15–28 ms before it does anything. Prompt cost is mostly how many processes each prompt starts:

  • starship init bash starts three starship processes per prompt. Ours starts one: bash 5 gives us $EPOCHREALTIME, so the two starship time calls aren't needed.
  • On zsh, starship's hook starts a second starship for the right prompt on every prompt, even when it's empty. Ours doesn't.
  • Init scripts (starship init, fzf --zsh, zoxide init) are cached to files and only regenerated when the program changes. That's one fewer process per tool, per new tab.
  • Big-repo mode: in a repo where git status makes the prompt slower than 300 ms, oh-my-gitbash remembers the repo and shows the branch without status there. It tells you when it does this. OMG_FAST_GIT=0 turns it off.

The startup budget the tests enforce: a new tab (Git Bash login, then zsh) ready to type in under 400 ms on the test machine.

Git Bash themes

soft-pills (default): Catppuccin Mocha, each item a rounded pill. The folder is peach, git green, languages sky, duration yellow (2 s or more), and the exit code red (failures only). ❯ sits on its own line in mauve, and turns red after a failure. Needs a Nerd Font.

soft-pills

minimal: one line, no icons, any font.

minimal

pastel: joined coloured segments, Tokyo Night. Needs a Nerd Font.

pastel

latte: the light theme. The soft-pills layout in Catppuccin Latte, for light terminals. Needs a Nerd Font.

latte

gruvbox-blocks: Gruvbox Dark, square colour blocks joined edge to edge. Needs a Nerd Font.

gruvbox-blocks

nord-frost: Nord, one line of coloured text with thin separators, no backgrounds. Needs a Nerd Font.

nord-frost

rose-pine: Rosé Pine, one line, words instead of icons ("on", "via", "took"). Works with any font, like minimal, but in colour.

rose-pine

Demo and screenshots are real output (a throwaway HOME, the real starship), rendered by scripts/record.sh. Themes are plain starship configs plus a Windows Terminal scheme and mintty colours. See CONTRIBUTING.md to add one.

FAQ

Do I need a Nerd Font? For most themes, yes: the pill caps, blocks and icons are Nerd Font glyphs. The installer offers to install JetBrainsMono Nerd Font for your user. minimal and rose-pine work with any font. After installing a font, restart Windows Terminal.

Do I need admin rights? No. zsh goes in ~/.oh-my-gitbash/zsh, not into C:\Program Files\Git. zsh is an MSYS program: started from Git Bash, it uses Git's own MSYS runtime, and we point its module and function paths at our folder.

What happens when I update Git for Windows? Nothing should break: zsh lives in our folder, which the Git updater doesn't touch (unlike a zsh copied into the Git folder by hand, which an update can remove or overwrite). If a new MSYS runtime ever stopped our zsh from starting, ~/.bashrc notices before switching to zsh, keeps you in bash, and tells you to run omg repair. omg doctor checks this too.

VS Code's terminal? Its "Git Bash" profile runs the same ~/.bashrc, so you get zsh there too. To keep plain bash somewhere, set OMG_NO_ZSH=1 in that terminal's environment (terminal.integrated.env.windows).

I want plain bash for a moment. OMG_NO_ZSH=1 bash. Scripts and bash -c '…' are never affected: the switch only happens for interactive shells on a terminal.

I already use Oh My Zsh / Powerlevel10k. They're left alone. Our block goes at the top of ~/.zshrc and your lines still run after it, so you'll get two setups. Either remove your old prompt lines (omg doctor points them out) or skip oh-my-gitbash. Powerlevel10k is very fast in big repos thanks to its gitstatus daemon (see the benchmark); we chose starship for themes that work in both bash and zsh, and an active upstream.

My prompt shows boxes. The font isn't a Nerd Font. Install one (omg repair), pick it in your terminal, or omg theme set minimal.

Can I keep my own starship config? Yours (~/.config/starship.toml) isn't touched; we point STARSHIP_CONFIG at ~/.oh-my-gitbash/starship.toml. To use yours, export STARSHIP_CONFIG=~/.config/starship.toml at the end of ~/.zshrc.

vs Oh My Zsh by hand, Oh My Posh, WSL

oh-my-gitbash By hand (the usual guides) Oh My Posh WSL
Setup one command ~10 manual steps: download zsh, extract into Program Files, edit .bashrc, install OMZ, plugins, font, terminal profile winget install + edit your profile enable WSL, install a distro, then set up zsh inside Linux
Admin rights no yes (writing into Program Files\Git) no yes
Survives Git for Windows updates yes (zsh lives outside the Git folder) not reliably: an update can remove or replace files in the Git folder yes n/a
Undo omg uninstall, byte-identical files by hand uninstall + edit profile remove the distro
Shells zsh, or bash lite mode zsh many (PowerShell, bash, zsh, …) any Linux shell
Prompt speed on Git Bash one process per prompt; big-repo mode depends on the theme; OMZ themes run several git commands per prompt one process per prompt in bash, more work per prompt (see benchmark) fast for Linux files, slow on /mnt/c
Windows files and tools native: same paths, .exes just work native native through /mnt/c, slower; Windows .exes work via interop
What you get zsh, plugins, prompt, terminal colours, fonts, matched what you assemble prompt themes only (great ones, many) a full Linux environment

Oh My Posh is a fine choice if you only want a prompt, especially if you also use PowerShell. WSL is the right choice if you need Linux tools, containers, or Linux-speed file I/O. oh-my-gitbash is for staying in Git Bash and getting zsh without the manual setup.

License

MIT. Uses zsh (MSYS2 package), starship, zsh-autosuggestions, zsh-syntax-highlighting, and optionally JetBrainsMono Nerd Font. Colours from Catppuccin, Tokyo Night, Gruvbox, Nord, Rosé Pine and One Half.

About

Beautiful themes, autosuggestions & syntax highlighting for Git Bash on Windows. Oh My Zsh-style setup in one command: no WSL, no admin, fully undoable.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages