Pure bash, zero-dependency git utilities. Reduce repetitive typing and supercharge git workflows with optional interactive previews and safe cleanup — see a full comparison.
npm i -g gitbash && gitbash --configgitbash --help # Show help
gitbash --version # Show version
gitbash --init # Print shell init code
gitbash --config # Interactive configuration wizard
gitbash --config-local # Configure local overrides for current repository
gitbash --config-user # Configure user-specific overrides (excluded from git)# Optional (recommended)
brew install fzf # Interactive menus and previews
brew install git-delta # Better diff highlighting
brew install bat # File preview with syntax highlightingInteractive menu for branch operations (create/switch/update).
branch # Interactive menu
branch -h # Show help
branch --version # Show versioncreate [JIRA_LINK|ISSUE] [TITLE...]Create feature branch with optional Jira parsing. Updates main first, pushes and tracks.
Branch Name Format: <type>/<custom-prefix>/<issue>-<title> or <type>/<custom-prefix>/<title>
Examples with custom prefix (GITBASH_CREATE_BRANCH_PREFIX="awesome-team"):
With issue parsing enabled (default):
create PROJ-123 fix login bug # → feature/awesome-team/PROJ-123-fix-login-bug
create fix bug # → feature/awesome-team/NOISSUE-fix-bug
create --hotfix PROJ-999 critical fix # → hotfix/awesome-team/PROJ-999-critical-fix
create # Interactive mode with Jira promptWith issue parsing disabled (GITBASH_CREATE_NO_ISSUE_PARSING="yes"):
create fix login bug # → feature/awesome-team/fix-login-bug
create --hotfix enhance security # → hotfix/awesome-team/enhance-security
create # Interactive mode (no Jira prompt)Examples with empty prefix (GITBASH_CREATE_BRANCH_PREFIX="", default):
With parsing enabled:
create PROJ-123 fix bug # → feature/PROJ-123-fix-bug
create fix bug # → feature/NOISSUE-fix-bugWith parsing disabled:
create enhance login screen # → feature/enhance-login-screenswitch [FILTER...]Switch branches with fzf. Shows local first, then remotes (deduped). Preview shows commit history.
switch # Browse all branches
switch captcha # Pre-filter for "captcha"commit [MESSAGE] [-p|--push] [-s|--staged]Commit with optional push. Smart staging: prompts if both staged/unstaged exist.
commit fix bug # Commit all
commit -s fix bug # Commit staged only
commit -p add feature # Commit and pushInteractive staging with fzf. Toggle files with Enter, ESC to exit. Shows diffs in preview.
pr [-p|--push]Open PR in browser. -p pushes first.
update [-p|--push]Merge latest main/master into current branch. Opens merge tool on conflicts.
stale [-a|--all] [--age=N] [--json] [FILTER...]List remote branches >3 months old (oldest first). Multi-select with TAB to delete.
- By default, pre-filters by your git username (from
git config user.name) -a|--allshows all branches without username filter--age=Nsets stale threshold in months (default: 3, orGITBASH_STALE_MONTHS)Ctrl-Atoggles showing all branches (including recent ones)--jsonoutputs JSON for scripting (same format as cleanup)
Interactive stash menu: create, apply, or delete stashes.
stash [NAME...]Create named stash (includes untracked files).
Apply stash with fzf picker. Optionally drop after applying.
Delete stashes (multi-select with TAB).
cleanup [--json]Find and delete leftover local branches. Shows all local branches categorized:
- [MERGED] - Remote was deleted (pre-selected)
- [STALE] - No commits in 7+ days (pre-selected)
- [RECENT] - Recent activity (not selected)
Switches to main/master first if current branch is selected for deletion.
--json outputs non-interactive JSON for scripting:
[
{
"last_change_timestamp": 1733123456,
"author_email": "dev@example.com",
"author_name": "Dev",
"name": "feature/old",
"last_change_relative": "2 weeks ago"
}
]commits [COUNT]List recent commits with option to revert. Multi-select with TAB to revert multiple.
commits # Show last 20 commits
commits 50 # Show last 50 commitsgitbash reads configuration from ~/.gitbashrc if it exists. You can set the following variables:
# Branch prefix inserted between type and issue number (default: "")
# No trailing slash needed - it's added automatically
# Format: <type>/<prefix>/<issue>-<title> or <type>/<prefix>/<title>
# Examples: "awesome-team" or "" for no prefix
GITBASH_CREATE_BRANCH_PREFIX=""
# Merge tool command invoked by 'update' when conflicts occur (default: "fork")
GITBASH_MERGE_COMMAND="fork"
# Disable Jira issue number parsing in branch names: yes or no (default: "no")
GITBASH_CREATE_NO_ISSUE_PARSING="no"
# Fallback prefix when no issue number is provided (default: "NOISSUE")
# Only used when GITBASH_CREATE_NO_ISSUE_PARSING="no"
GITBASH_CREATE_ISSUE_PARSING_FALLBACK="NOISSUE"
# Theme for delta/bat diff highlighting: auto, dark, or light (default: "light")
GITBASH_THEME="light"
# Stale branch threshold in months for 'stale' command (default: 3)
GITBASH_STALE_MONTHS=3
# Cleanup threshold in days - branches merged more than this many days ago (default: 7)
GITBASH_CLEANUP_DAYS=7You can create this file manually or use gitbash --config to configure interactively.
gitbash also supports repository-specific configuration overrides. Run gitbash --config-local inside a git repository to create a .gitbashrc file in the repository root.
Local settings override the global ~/.gitbashrc for that repository only. This is useful for:
- Different branch prefixes per project (e.g., team names)
- Project-specific issue parsing settings
- Different stale/cleanup thresholds per repository
The interactive wizard will show each setting's current global value and ask if you want to override it locally. Only overridden values are written to the local config.
For personal settings that should not be committed to version control, run gitbash --config-user to create a .gitbashrc-user file in the repository root.
User settings override both global (~/.gitbashrc) and local (.gitbashrc) settings. The file is automatically added to .gitignore.
Configuration priority (highest to lowest):
.gitbashrc-user- User-specific settings (not committed).gitbashrc- Repository settings (can be committed)~/.gitbashrc- Global settings
Instead of adding every command via eval "$(gitbash --init)" in .zshrc or .bashrc
direct usage with gitbash [command] is also possible. Or if desired, individual aliases
can be made.
alias branch="gitbash branch"
alias cleanstash="gitbash cleanstash"
alias cleanup="gitbash cleanup"
alias commit="gitbash commit"
alias commits="gitbash commits"
alias create="gitbash create"
alias pr="gitbash pr"
alias stale="gitbash stale"
alias stash="gitbash stash"
alias stashes="gitbash stashes"
alias status="gitbash status"
alias switch="gitbash switch"
alias unstash="gitbash unstash"
alias update="gitbash update"See LICENSE file for details.
