gitbutler-omz

April 4, 2026 · View on GitHub

An Oh My Zsh plugin for GitButler — CLI aliases, a Git protection shield, and prompt integration for standard OMZ themes and Powerlevel10k.

License: MIT Oh My Zsh Powerlevel10k


Features

  • 50+ CLI Aliases — Short, memorable shortcuts for all but commands, grouped by workflow
  • Git Protection Shield — Intercepts destructive git commands when on the gitbutler/workspace branch and prompts for confirmation
  • Prompt Integration — Replaces the default branch name with live GitButler workspace metrics (active branch count, dirty state, pending pushes) in standard OMZ themes
  • Powerlevel10k Support — Patches my_git_formatter to display GitButler-aware status in the p10k prompt

Requirements

  • Zsh with Oh My Zsh installed
  • but CLI installed and available in $PATH
  • jq — required for prompt integration (aliases still work without it)

Installation

1. Clone this repository into your Oh My Zsh custom plugins directory:

git clone https://github.com/batuhan0sanli/gitbutler-omz \
  ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/gitbutler

2. Add gitbutler to the plugins list in your ~/.zshrc:

plugins=(... gitbutler)

3. Reload your shell:

source ~/.zshrc

Antigen

antigen bundle batuhan0sanli/gitbutler-omz

Zinit

zinit light batuhan0sanli/gitbutler-omz

Manual

Source the plugin file directly from your ~/.zshrc:

source /path/to/gitbutler-omz/gitbutler.plugin.zsh

Aliases

Inspection

AliasCommandDescription
bstbut statusShow workspace state
bstvbut status -f -vShow status with committed files (verbose)
bstubut status -uShow unintegrated upstream commits
bdbut diffShow diff of current changes
bshbut showShow details of a commit or branch

Branch Management

AliasCommandDescription
bbbut branchList branches
bblbut branch listList all branches with search
bbnbut branch newCreate a new parallel branch
bbnsbut branch new --anchorCreate a new stacked branch
bbrbut branch rewordRename a branch
bbdbut branch deleteDelete a branch
bbmbut branch moveMove / restack a branch
bbsbut branch showShow commits ahead of base for a branch
bbabut applyApply a branch to the workspace
bbuabut unapplyUnapply a branch from the workspace

Committing

AliasCommandDescription
bcmbut commit -mCommit with a message
bcaibut commit --aiCommit with an AI-generated message
bccbut commit -cCreate a new branch and commit to it
bcobut commit --onlyCommit only already-staged changes
bsgbut stageStage a file or hunk to a branch
babbut absorbAbsorb changes into appropriate commits
bucbut uncommitUncommit changes back to unstaged area
bambut amendAmend a file change into a specific commit

Remote & Pull Requests

AliasCommandDescription
bpbut pushPush all branches with unpushed commits
bpfbut push --with-forceForce push a branch
blbut pullPull and integrate all active branches
blcbut pull --checkPreview what a pull would do
bprbut prManage pull requests
bprnbut pr newCreate a new pull request
bprdbut pr set-draftSet a PR as draft
bprrbut pr set-readySet a PR as ready to review

Commit Editing

AliasCommandDescription
brwbut rewordEdit a commit message
bsqbut squashSquash commits together
bmvbut moveMove a commit or branch
bdcbut discardDiscard uncommitted changes
bcpbut pickCherry-pick a commit into an applied branch
brbbut rubCombine two commits or branches

Operation Log

AliasCommandDescription
bundobut undoUndo the last operation
bolbut oplogShow operation history
bolsbut oplog snapshotCreate an on-demand snapshot
bolrbut oplog restoreRestore to a specific snapshot

Conflict Management

AliasCommandDescription
brsbut resolveEnter conflict resolution mode
bmrgbut mergeMerge a branch into a local target branch

Auto-Assignment

AliasCommandDescription
bmkbut markMark a branch or commit for auto-stage/commit
bumkbut unmarkRemove all marks from workspace

Workspace

AliasCommandDescription
bguibut guiOpen the GitButler GUI
bclbut cleanRemove empty branches
bsubut setupSet up GitButler in current repository
btdbut teardownReturn to vanilla git branch management

Git Protection Shield

When you are on the gitbutler/workspace branch, the plugin wraps the git command and intercepts potentially destructive operations:

add, commit, push, checkout, merge, rebase, stash, cherry-pick, branch

Running any of these will display a warning and prompt for confirmation before proceeding:

[GitButler Protection] Using git commit in GitButler mode will break the structure.
Please use 'but' commands (e.g.: but commit, but branch new, but stage).
Are you sure you want to continue with the standard git command? [y/N]

All other git commands (e.g. git log, git diff) pass through unmodified.


Prompt Integration

Standard Oh My Zsh Themes

When on the gitbutler/workspace branch the plugin overrides git_prompt_info() to show live workspace metrics instead of the raw branch name:

[but  3 ⇡2 ✗]
     ▲  ▲  ▲
     │  │  └─ dirty indicator (theme's CLEAN/DIRTY symbol)
     │  └──── pending pushes (branches with unpushed commits)
     └─────── active branch count

The git prefix in the theme's prompt is automatically replaced with but.

Powerlevel10k

The plugin patches my_git_formatter (the recommended customization point in p10k) on the first precmd call after sourcing. The workspace segment becomes:

⧓ 3 ⇡2 *
  ▲  ▲  ▲
  │  │  └─ dirty indicator
  │  └──── pending pushes
  └─────── active branch count

Note: The p10k patch only activates if my_git_formatter is already defined when the plugin loads (i.e. your ~/.p10k.zsh must be sourced before or alongside the plugin).


Uninstall

1. Remove gitbutler from the plugins list in ~/.zshrc.

2. Delete the plugin directory:

rm -rf ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/gitbutler

3. Reload your shell:

source ~/.zshrc

License

MIT © Batuhan Sanli