Skip to main content
Display your current wit branch directly in your terminal prompt, just like you would with Git. This helps you always know which branch you’re working on.

How It Works

wit provides plumbing commands that output the current branch name, which can be used in your shell prompt:

Bash Integration

Add the following to your ~/.bashrc:
After adding this, reload your shell:

Example Output

Zsh Integration

Add the following to your ~/.zshrc:
After adding this, reload your shell:

With Oh My Zsh

If you use Oh My Zsh, you can create a custom plugin. Create the file ~/.oh-my-zsh/custom/plugins/wit/wit.plugin.zsh:
Then add wit to your plugins in ~/.zshrc:

Advanced: Detached HEAD State

When you checkout a specific commit (detached HEAD state), the branch name won’t be available. You can show the short commit hash instead:

Bash (with detached HEAD support)

Zsh (with detached HEAD support)

Advanced: Dirty State Indicator

Show an asterisk when you have uncommitted changes:

Bash

Zsh

Performance Tips

The prompt function runs every time you press Enter, so it’s important to keep it fast.
  1. Use 2>/dev/null to suppress error messages when not in a wit repository
  2. Avoid multiple wit calls - each command spawns a new process
  3. Consider caching for very large repositories:

Fish Shell Integration

For Fish shell users, add this to ~/.config/fish/functions/fish_prompt.fish:

Starship Integration

If you use Starship, add a custom command to ~/.config/starship.toml:

Troubleshooting

  1. Make sure you’re inside a wit repository (has a .wit directory)
  2. Verify wit is installed and in your PATH: which wit
  3. Test the command manually: wit rev-parse --abbrev-ref HEAD
If your prompt is slow:
  1. Make sure you’re not running multiple wit commands in the function
  2. Consider using the caching approach above
  3. Check if your repository is very large
Always use 2>/dev/null to suppress errors when not in a wit repository. The functions above handle this automatically.

Next Steps

Commands Reference

Learn all available commands

Configuration

Customize wit behavior