gitbasher 3.10.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,663 +1,1022 @@
1
- # gitbasher – simple **bash** utility that makes **git** easy to use
1
+ <h1 align="center">gitbasher</h1>
2
2
 
3
+ <p align="center">
4
+ <strong>The friendly <code>git</code> wrapper that types the boring parts for you.</strong>
5
+ </p>
3
6
 
4
- [![Latest Release](https://img.shields.io/github/v/release/maxbolgarin/gitbasher.svg?style=flat-square)](https://github.com/maxbolgarin/gitbasher/releases/latest)
5
- [![GitHub license](https://img.shields.io/github/license/maxbolgarin/gitbasher.svg)](https://github.com/maxbolgarin/gitbasher/blob/master/LICENSE)
6
- [![Build Status](https://github.com/maxbolgarin/gitbasher/actions/workflows/build.yml/badge.svg)](https://github.com/maxbolgarin/gitbasher/actions)
7
+ <p align="center">
8
+ <a href="https://github.com/maxbolgarin/gitbasher/releases/latest"><img src="https://img.shields.io/github/v/release/maxbolgarin/gitbasher.svg?style=flat-square" alt="Latest Release"></a>
9
+ <a href="https://github.com/maxbolgarin/gitbasher/blob/main/LICENSE"><img src="https://img.shields.io/github/license/maxbolgarin/gitbasher.svg" alt="License"></a>
10
+ <a href="https://github.com/maxbolgarin/gitbasher/actions"><img src="https://github.com/maxbolgarin/gitbasher/actions/workflows/build.yml/badge.svg" alt="Build Status"></a>
11
+ </p>
7
12
 
8
- <picture>
9
- <img src=".github/commit.gif" width="600" alt="commit example">
10
- </picture>
13
+ <p align="center">
14
+ <a href="https://maxbolgarin.github.io/gitbasher/"><strong>Website</strong></a> ·
15
+ <a href="#install-in-10-seconds">Install</a> ·
16
+ <a href="#all-features-at-a-glance">Features</a> ·
17
+ <a href="./FAQ.md">FAQ</a>
18
+ </p>
11
19
 
12
- ---
20
+ <p align="center">
21
+ <img src=".github/commit.gif" width="640" alt="gitb commit demo" />
22
+ </p>
13
23
 
14
- With **gitbasher** usage of `git` becomes more simple and intuitive. It helps speeding up the development process, making it more consistent reducing mistakes. This is a wrapper around the most used git commands with a cleaner interface. It uses `bash` `git` `sed` `grep`, `curl` and some built-in utilities.
24
+ ---
15
25
 
26
+ ## In 30 seconds
16
27
 
17
- ### Quick Installation (recommended)
28
+ - **What it is** — a single-binary `bash` wrapper for `git`. Short interactive commands replace long flag chains.
29
+ - **Who it's for** — developers who want clean conventional commits, smart pull/push/sync, and undo-everything safety without memorizing git plumbing.
30
+ - **What's different** — AI commit messages that can run **fully local** via Ollama (no key, no network), atomic split, WIP backup across machines, full worktree menu — all in one bash file.
18
31
 
19
32
  ```bash
20
- GITB_PATH=/usr/local/bin/gitb && \
21
- sudo mkdir -p $(dirname $GITB_PATH) && \
22
- curl -fSL https://github.com/maxbolgarin/gitbasher/releases/latest/download/gitb | sudo tee $GITB_PATH > /dev/null && \
23
- sudo chmod +x $GITB_PATH
33
+ gitb commit push # stage, write a conventional commit, push — in one flow
34
+ gitb commit ai # AI-generated commit message
35
+ gitb sync # fetch main + rebase your branch
36
+ gitb wip up # stash WIP, push backup branch, clean working tree
37
+ gitb undo # roll back your last commit / amend / merge / rebase / stash
24
38
  ```
25
39
 
26
- Or using npm:
27
-
28
- ```bash
29
- npm install -g gitbasher
30
- ```
40
+ ---
31
41
 
32
- In Windows use `wsl` (enter `wsl` in terminal, [read more](https://learn.microsoft.com/en-us/windows/wsl/setup/environment)) to enable Linux environment. Directory `/usr/local/bin/` is not mandatory. If you get `Permission denied`, use `sudo` or put it to `~/.local/bin` with adding it to `PATH` ([how](https://discussions.apple.com/thread/254226896)).
42
+ ## Before & after
33
43
 
44
+ You just write what you want to do, and gitbasher will do it for you. All commands have a short alias, for example `gitb c` is equivalent to `gitb commit`.
34
45
 
35
- ## Table of Contents
36
- - [Quick Start Guide](#quick-start-guide)
37
- - [Why You Should Try This](#why-you-should-try-this)
38
- - [Real-World Examples](#real-world-examples)
39
- - [AI-Powered Commits](#ai-powered-commits)
40
- - [Common Workflows](#common-workflows)
41
- - [Complete Documentation](#complete-documentation)
42
- - [Troubleshooting & FAQ](#troubleshooting--faq)
43
- - [Contributing](#contributing)
46
+ | Task | Plain `git` | With `gitb` |
47
+ |------|-------------|-------------|
48
+ | Start a feature off updated main | `git fetch && git checkout main && git pull --ff-only && git checkout -b feat/x` | `gitb branch newd` |
49
+ | Conventional commit + push | `git add -A && git commit -m "feat(x): …" && git push -u origin HEAD` | `gitb commit ai fast push` |
50
+ | Sync your branch with main | `git fetch && git rebase origin/main && git push --force-with-lease` | `gitb sync push` |
51
+ | Save WIP & clean tree across machines | `git stash -u && git push origin "HEAD:wip/$(git symbolic-ref --short HEAD)"` | `gitb wip up` |
52
+ | Undo last commit (keep changes staged) | `git reset --soft HEAD~1` | `gitb undo` |
53
+ | Tidy a messy branch into clean commits | (interactive rebase, fold by hand) | `gitb squash` |
44
54
 
55
+ ---
45
56
 
46
- ## Quick Start Guide
57
+ ## Install in 10 seconds
47
58
 
48
- ### 1. First Steps
59
+ ### One-liner
49
60
  ```bash
50
- # Navigate to any git repository
51
- cd your-project
52
-
53
- # See all available commands
54
- gitb
61
+ curl -fsSL https://raw.githubusercontent.com/maxbolgarin/gitbasher/main/install.sh | bash
55
62
  ```
56
63
 
57
- ### 2. Your First Commit
58
- ```bash
59
- # Smart commit - select files and create conventional message
60
- gitb commit
64
+ The installer drops `gitb` into `~/.local/bin` by default — no `sudo`, no password prompt. It downloads the latest release, verifies its SHA-256, and prints a PATH hint if needed.
61
65
 
62
- # Fast commit - add all files with quick message
63
- gitb commit fast
64
66
 
65
- # AI-powered commit (after setting up API key)
66
- gitb commit ai
67
+ ### npm (easy to remember)
68
+ ```bash
69
+ npm install -g gitbasher
67
70
  ```
68
71
 
69
- ### 3. Essential Daily Commands
72
+ ---
73
+
74
+ ## 60-second quick start
75
+
70
76
  ```bash
71
- gitb status # Check status
72
- gitb commit # Make a commit
73
- gitb push # Push changes
74
- gitb pull # Pull changes
75
- gitb branch # Switch branches
77
+ cd your-project
78
+ gitb # see all commands
79
+ gitb cfg user # set your name/email once
80
+ gitb cfg ai # (optional) plug in an AI key for smart commits
81
+
82
+ gitb status # what's changed?
83
+ gitb commit # interactive conventional commit
84
+ gitb push # safe push with conflict handling
85
+ gitb pull # smart pull (rebase / merge / ff)
86
+ gitb branch new # create a new conventionally-named branch
76
87
  ```
77
88
 
78
- ### 4. Set Up Your Environment
79
- ```bash
80
- # Configure your identity
81
- gitb cfg user
89
+ Every command has a short alias (`gitb c`, `gitb p`, `gitb pu`, `gitb b`, `gitb s`, …) and inline help (`gitb commit help`).
82
90
 
83
- # Set default branch (usually 'main' or 'master')
84
- gitb cfg default
91
+ ---
85
92
 
86
- # Set up AI features (optional but recommended)
87
- gitb cfg ai
88
- ```
93
+ ## Table of contents
94
+ - [Why gitbasher](#why-gitbasher)
95
+ - [All features at a glance](#all-features-at-a-glance)
96
+ - [Common workflows](#common-workflows)
97
+ - [AI-powered commits](#ai-powered-commits)
98
+ - [Command reference](#command-reference)
99
+ - [Configuration](#configuration)
100
+ - [Other install paths](#other-install-paths)
101
+ - [Uninstall](#uninstall)
102
+ - [Troubleshooting](#troubleshooting)
103
+ - [Contributing](#contributing)
89
104
 
105
+ ---
90
106
 
91
- ## Why You Should Try This
107
+ ## Why gitbasher
92
108
 
93
- **gitbasher** is essential if you use `git` on the daily basis. Benefits you will get:
109
+ - **Zero memorization** — no flags to remember, no man pages to grep. Interactive menus where it matters, short aliases where it doesn't.
110
+ - **Conventional commits, free** — type/scope/summary picker built-in, with optional ticket prefixes and a multiline editor mode.
111
+ - **AI commit messages** — `gitb c ai` writes the message from your diff. OpenRouter (Gemini/Claude/GPT/…), OpenAI direct, or **fully local via Ollama** — no key, no network, no data leaves your machine.
112
+ - **Safer git** — push/pull detect conflicts up front, `undo` rolls back commit/amend/merge/rebase/stash, `reset` is interactive with a preview.
113
+ - **Whole workflows, not just commands** — `sync`, `wip`, `branch newd`, `merge to-main`, `squash` chain the steps you'd otherwise do by hand.
114
+ - **One file, no deps** — pure bash. Drop the binary anywhere on `PATH` and go. **115+ BATS tests** cover sanitization, git ops, and branch logic.
94
115
 
95
- * **⚡ Faster Development**: Spend almost no time on git commands
96
- * **🧠 No More Memorizing**: No need to remember/google exact command names and parameters
97
- * **📝 Better Commit Messages**: Conventional commits with manual or **AI-generated** messages
98
- * **🔧 Advanced Commands Made Easy**: Use `git rebase`, `git stash`, and hooks without complexity
99
- * **🌊 GitHub Flow**: Simplified branch management following best practices
100
- * **🎯 Consistent Workflow**: Standardized processes across your team
116
+ <p align="center">
117
+ <img src=".github/push.gif" width="640" alt="gitb push demo" />
118
+ </p>
101
119
 
102
- <picture>
103
- <img src=".github/push.gif" width="600" alt="push example">
104
- </picture>
120
+ ---
105
121
 
122
+ ## All features at a glance
123
+
124
+ | Group | Commands | What you get |
125
+ |-------|----------|--------------|
126
+ | **Commit** | `commit` (`c`), `edit` (`ed`) | Interactive conventional commits, fast-mode, AI messages, atomic split, fixup, amend, revert; `gitb edit` reworks the last commit message, picks any commit to reword, or renames the current branch |
127
+ | **Sync remote** | `push` (`p`), `pull` (`pu`), `sync` (`sy`) | Safe push (with force/list), smart pull (rebase / merge / ff), one-shot rebase-on-main with optional force-push |
128
+ | **Branches** | `branch` (`b`), `prev` (`-`) | List / switch / create-from-current / create-from-updated-main / delete (orphaned, merged, gone) / recent / previous / checkout-tag |
129
+ | **Integration** | `merge` (`m`), `rebase` (`r`), `squash` (`sq`), `cherry` (`ch`) | Merge into current / into main / from remote · rebase onto main / interactive / autosquash / fastautosquash / pull-commits · AI-driven squash of branch commits into changelog-ready history · cherry-pick by hash, range, or interactive |
130
+ | **Tags & releases** | `tag` (`t`) | Lightweight, annotated, from-commit, push, push-all, delete, delete-all, list, fetch-remote |
131
+ | **Save & rollback** | `wip` (`up`/`down`), `undo` (`un`), `reset` (`res`), `stash` (`st`) | Save WIP via stash / branch / worktree (auto-detected on restore) · undo last commit/amend/merge/rebase/stash · interactive reset · full stash menu |
132
+ | **Worktrees** | `worktree` (`wt`) | Add / list / remove / move / lock / prune git worktrees, with new branch from current/main or from existing/remote branches |
133
+ | **Inspect** | `status` (`s`), `log` (`l`), `reflog` (`rl`), `last-commit` (`lc`), `last-ref` (`lr`) | Pretty repo status, multi-mode log + search, reflog viewer, quick last-commit / last-ref summary |
134
+ | **Hooks** | `hook` (`ho`) | List / create from templates / edit / toggle / remove / test / show — for every git hook |
135
+ | **Repo setup** | `init` (`i`), `origin` (`or`, `o`, `remote`) | `git init` from gitbasher · add/change/rename/remove the remote origin |
136
+ | **Config** | `config` (`cfg`) | User, default branch, separator, editor, ticket prefix, scopes, AI provider/key/model, proxy, completion |
137
+ | **Lifecycle** | `update` (`up`), `uninstall` (`uns`) | Self-update from latest GitHub release · one-shot uninstall (config + binary) |
138
+
139
+ Total: **24 top-level commands**, **60+ aliases**, **100+ modes**.
106
140
 
107
- ## Real-World Examples
141
+ ---
108
142
 
109
- ### 🚀 Scenario 1: Starting a New Feature
143
+ ## Common workflows
110
144
 
111
- **Traditional Git:**
145
+ ### Daily development
112
146
  ```bash
113
- git switch main # Switch to main
114
- git pull origin main # Get latest changes
115
- git switch -c feature/user-auth # Create new branch
116
- # ... make changes ...
117
- git add src/auth.js src/login.js # Stage files
118
- git commit -m "feat(auth): add user authentication system"
119
- git push -u origin feature/user-auth
147
+ gitb status
148
+ gitb pull
149
+ gitb branch new
150
+ # ... code ...
151
+ gitb commit ai fast push
120
152
  ```
121
153
 
122
- **With gitbasher:**
154
+ ### Code-review cycle
123
155
  ```bash
124
- gitb branch newd # Create new branch from updated main
125
- # ... make changes ...
126
- gitb commit push # Smart commit + push
156
+ gitb commit fix
157
+ gitb rebase autosquash
158
+ gitb push force
127
159
  ```
128
160
 
129
- ### 🐛 Scenario 2: Quick Bug Fix
161
+ ### Sync with main mid-feature
162
+ ```bash
163
+ gitb sync # fetch main + rebase your branch
164
+ gitb sync push # …and force-push
165
+ gitb sync merge # use merge instead of rebase
166
+ ```
130
167
 
131
- **Traditional Git:**
168
+ ### Save WIP across machines / branches
132
169
  ```bash
133
- git status # Check what's changed
134
- git add . # Add all files
135
- git commit -m "fix: resolve login issue"
136
- git push
170
+ gitb wip up # stash changes + push backup to origin/wip/<branch>
171
+ # … on another machine …
172
+ gitb pull # fetch the wip/<branch>
173
+ gitb wip down # pop the wip stash and remove the remote backup
137
174
  ```
138
175
 
139
- **With gitbasher:**
176
+ ### Hotfix
140
177
  ```bash
141
- gitb commit push # Fast commit + push (one command!)
178
+ gitb b m # switch to main
179
+ gitb pu # latest changes
180
+ gitb b n # hotfix branch
181
+ gitb c aifp # fast AI commit + push
182
+ gitb m tm # merge to main
142
183
  ```
143
184
 
144
- ### 🔀 Scenario 3: Merging Feature Branch
185
+ ### Release
186
+ ```bash
187
+ gitb b m
188
+ gitb pu
189
+ gitb l # review log
190
+ gitb t a # annotated tag
191
+ gitb t p # push tag
192
+ ```
145
193
 
146
- **Traditional Git:**
194
+ ### Roll back a mistake
147
195
  ```bash
148
- git switch main
149
- git pull origin main
150
- git merge feature/user-auth
151
- git push origin main
152
- git branch -d feature/user-auth
196
+ gitb undo # undo last commit (keeps changes staged)
197
+ gitb undo amend # restore pre-amend state via reflog
198
+ gitb undo merge # abort or undo last merge
199
+ gitb undo rebase # abort or undo last rebase
200
+ gitb undo stash # re-stash a popped stash
153
201
  ```
154
202
 
155
- **With gitbasher:**
203
+ ### Branch hygiene
156
204
  ```bash
157
- gitb merge to-main # Switch to main and merge current branch
158
- gitb branch delete # Select and delete the merged branch
205
+ gitb b rc # pick from recently used branches
206
+ gitb b g # delete local branches whose remote is gone
207
+ gitb b del # interactive delete (orphaned / merged / pick)
208
+ gitb b - # back to previous branch (like cd -)
159
209
  ```
160
210
 
161
- ### 🤖 Scenario 4: AI-Powered Development
211
+ ---
212
+
213
+ ## AI-powered commits
214
+
215
+ Drop in an API key once (or run a local model with no key at all), then let an LLM write conventional commit messages from your diff.
216
+
217
+ ### Providers
218
+
219
+ gitbasher supports three providers behind the same OpenAI-style chat-completions API. Default is `openrouter` — existing setups keep working unchanged.
220
+
221
+ | Provider | Best for | Needs key? |
222
+ |----------|----------|-----------|
223
+ | `openrouter` (default) | Trying many models behind one key (Gemini, Claude, GPT, DeepSeek…) | Yes — [openrouter.ai/keys](https://openrouter.ai/keys) |
224
+ | `openai` | Direct access to GPT-5.4 family at OpenAI's own pricing | Yes — [platform.openai.com/api-keys](https://platform.openai.com/api-keys) |
225
+ | `ollama` | **Fully local, fully private** — no key, no network, runs on your machine | No |
226
+
227
+ ### Setup
162
228
 
163
- **After making changes to multiple files:**
164
229
  ```bash
165
- gitb commit ai # AI analyzes changes and generates:
166
- # "feat(auth): implement JWT authentication with refresh tokens"
230
+ # 1. Pick a provider (skip to use the OpenRouter default)
231
+ gitb cfg provider # interactive — choose openrouter, openai, or ollama
232
+
233
+ # 2. For openrouter / openai: paste your key (local repo or global)
234
+ gitb cfg ai
235
+
236
+ # For ollama: just make sure the daemon is running and the default model is pulled
237
+ ollama serve &
238
+ ollama pull qwen3:8b
239
+
240
+ # 3. Optional: HTTP proxy (for restricted regions, openrouter/openai only)
241
+ gitb cfg proxy
167
242
  ```
168
243
 
169
- **For quick fixes:**
244
+ For the security-conscious, prefer the env var to avoid the key landing in `~/.gitconfig`:
170
245
  ```bash
171
- gitb commit aif # AI commit all files with smart message
246
+ export GITB_AI_API_KEY='sk-...'
172
247
  ```
173
248
 
174
- ### 🎯 Scenario 5: Code Review Preparation
249
+ <details>
250
+ <summary><b>Default models per provider</b> (click to expand)</summary>
251
+
252
+ Each task uses a model tuned for speed/cost/quality, picked per provider. Defaults (May 2026):
253
+
254
+ **OpenRouter** (default provider)
255
+
256
+ | Task | Default model | Why |
257
+ |------|---------------|-----|
258
+ | `simple` (one-line message) | `google/gemini-3.1-flash-lite-preview` | Cheapest fast tier |
259
+ | `subject` (after manual type/scope) | `google/gemini-3.1-flash-lite-preview` | Short structured output |
260
+ | `full` (header + body) | `google/gemini-3-flash-preview` | Better prose |
261
+ | `grouping` (atomic-split mapping) | `anthropic/claude-haiku-4.5` | Strict instruction following |
262
+
263
+ **OpenAI** — GPT-5.4 family (released March 2026)
264
+
265
+ | Task | Default model | Why |
266
+ |------|---------------|-----|
267
+ | `simple` / `subject` | `gpt-5.4-nano` | Built for classification/short well-defined output, ~$0.20 / $1.25 per M tokens |
268
+ | `full` | `gpt-5.4-mini` | Stronger multi-condition instruction following for header + body, ~$0.75 / $4.50 per M |
269
+ | `grouping` | `gpt-5.4-mini` | Holds the strict TSV format under validation, far cheaper than the flagship |
270
+
271
+ **Ollama** — fully local
272
+
273
+ | Task | Default model | Why |
274
+ |------|---------------|-----|
275
+ | All tasks | `qwen3:8b` | Best small instruction-follower among 7/8B models; most stable structured output (rarely drops fields in TSV); ~5 GB on disk, ~25 tok/s on a consumer laptop with GPU |
276
+
277
+ Other strong local picks: `llama3.3:8b` (general-purpose), `qwen2.5-coder:7b` (code-heavy diffs).
175
278
 
176
- **Clean up commits before PR:**
279
+ Override per task or globally:
177
280
  ```bash
178
- gitb rebase i # Interactive rebase to squash/reorder commits
179
- gitb commit fix # Create fixup commits for review feedback
180
- gitb rebase s # Auto-squash fixup commits
281
+ gitb cfg model # interactive
282
+ git config gitbasher.ai-model <model_id> # global
283
+ git config gitbasher.ai-model-simple <model_id> # per-task
284
+ git config gitbasher.ai-model-subject <model_id>
285
+ git config gitbasher.ai-model-full <model_id>
286
+ git config gitbasher.ai-model-grouping <model_id>
181
287
  ```
182
288
 
183
- ### 📦 Scenario 6: Release Management
289
+ </details>
184
290
 
185
- **Creating and managing releases:**
291
+ <details>
292
+ <summary><b>Custom OpenAI-compatible endpoints</b> (LiteLLM, vLLM, remote Ollama)</summary>
293
+
294
+ Self-hosted gateways and remote Ollama hosts work via a base-URL override:
186
295
  ```bash
187
- gitb tag # Create version tag
188
- gitb tag push # Push tag to remote
189
- gitb log # Review commit history
296
+ gitb cfg provider # pick openai or ollama as the closest match
297
+ git config gitbasher.ai-base-url http://my-gateway:4000/v1/chat/completions
190
298
  ```
191
299
 
300
+ </details>
192
301
 
193
- ## AI-Powered Commits
302
+ ---
194
303
 
195
- Transform your commit workflow with AI-generated messages that follow conventional commit standards.
304
+ ## Command reference
305
+
306
+ > **Tip:** every command accepts `help` (`h`) for inline help: `gitb commit help`, `gitb sync h`.
307
+
308
+ | Command | Aliases | Description |
309
+ |---------|---------|-------------|
310
+ | [`commit`](#gitb-commit) | `c` `co` `com` | Create commits (interactive, fast, AI, split, fixup, amend, revert, …) |
311
+ | [`edit`](#gitb-edit) | `ed` `ee` | Rewrite the last commit message, reword an older commit, or rename the current branch |
312
+ | [`push`](#gitb-push) | `p` `ps` `pus` | Push with conflict handling, force, or list-only |
313
+ | [`pull`](#gitb-pull) | `pu` `pl` `pul` | Smart pull: rebase / merge / ff / fetch-only / interactive / dry-run |
314
+ | [`branch`](#gitb-branch) | `b` `br` `bran` | Switch / list / create / delete / recent / gone / checkout-tag |
315
+ | [`tag`](#gitb-tag) | `t` `tg` | Create, push, list, delete tags (lightweight & annotated) |
316
+ | [`merge`](#gitb-merge) | `m` `me` | Merge into current, into main, or from remote |
317
+ | [`rebase`](#gitb-rebase) | `r` `re` `base` | Rebase onto main / interactive / autosquash / pull-commits |
318
+ | [`squash`](#gitb-squash) | `sq` `tidy` | AI groups branch commits into clean, changelog-ready history |
319
+ | [`cherry`](#gitb-cherry) | `ch` `cp` | Cherry-pick by hash, range, or interactive picker |
320
+ | [`sync`](#gitb-sync) | `sy` | Fetch main + rebase (or merge) current branch, optional push |
321
+ | [`wip`](#gitb-wip) | `w` | Stash all + backup to remote (`up`) / restore (`down`) |
322
+ | [`undo`](#gitb-undo) | `un` | Undo last commit / amend / merge / rebase / stash |
323
+ | [`reset`](#gitb-reset) | `res` | Friendly `git reset` with preview, approval, and undo support |
324
+ | [`stash`](#gitb-stash) | `st` `sta` | Full stash menu: select, all, list, pop, apply, show, drop |
325
+ | [`worktree`](#gitb-worktree) | `wt` `tree` | Manage git worktrees: add, list, remove, move, lock, prune |
326
+ | [`hook`](#gitb-hook) | `ho` `hk` | Manage git hooks: list, create, edit, toggle, remove, test, show |
327
+ | [`origin`](#gitb-origin) | `or` `o` `remote` | Add, change, rename, or remove the remote origin |
328
+ | [`init`](#gitb-init) | `i` | `git init` + optional origin setup prompt |
329
+ | [`config`](#gitb-config) | `cf` `cfg` `conf` | Configure user, branch, AI, scopes, ticket prefix, etc. |
330
+ | [`log`](#gitb-log) | `l` `lg` | Pretty log: current, branch, compare, search |
331
+ | [`status`](#info-commands) | `s` | Repo status and changed files |
332
+ | [`reflog`](#info-commands) | `rl` `rlg` | Pretty reflog |
333
+ | [`last-commit`](#info-commands) | `lc` `lastc` | Show the last commit |
334
+ | [`last-ref`](#info-commands) | `lr` `lastr` | Show the last reference |
335
+ | [`prev`](#gitb-branch) | `-` | Switch to previous branch (`cd -`) |
196
336
 
197
- ### Setup (One-time)
337
+ ---
198
338
 
199
- #### 1. Get Your API Key
200
- - Visit [Google AI Studio](https://aistudio.google.com/app/apikey)
201
- - Create a new API key
202
- - Copy it for the next step
339
+ ### `gitb commit`
203
340
 
204
- #### 2. Configure gitbasher
205
- ```bash
206
- gitb cfg ai
207
- # Enter your API key when prompted
208
- # Choose local (current repo) or global (all repos)
341
+ A commit invocation is one **action** plus zero or more **modifiers**. Words can be combined freely (`ai fast push`) or written as a single compact token (`aifp`). Aliases are interchangeable.
342
+
343
+ ```text
344
+ gitb commit [<flag> ...] # space-separated, any order
345
+ gitb commit <combined> # compact form: ff, aifp, fastsp, ...
209
346
  ```
210
347
 
211
- #### 3. Optional: Proxy Setup
212
- For regions with API restrictions:
348
+ **Actions** — pick one; default is a regular commit.
349
+
350
+ | Action | Aliases | Description |
351
+ |--------|---------|-------------|
352
+ | `<empty>` | | Interactive commit: choose files, type, scope, and summary |
353
+ | `split` | `sp` `sl` | Split staged changes into one commit per detected scope |
354
+ | `fixup` | `x` `fix` | Create a `--fixup` commit against an older commit |
355
+ | `amend` | `a` `am` | Add changes into the last commit (no message edit) |
356
+ | `revert` | `rev` | Revert a commit (`git revert --no-edit`) |
357
+ | `ff` | | Ultrafast: `ai + split + fast` with no prompts (use `ffp` to also push) |
358
+ | `help` | `h` `--help` `-h` | Show inline help |
359
+
360
+ **Modifiers** — stack with an action, any order.
361
+
362
+ | Flag | Aliases | Description |
363
+ |------|---------|-------------|
364
+ | `fast` | `f` | Stage all changes (`git add .`) before committing |
365
+ | `staged` | `st` | Use already-staged files (skip the add step) |
366
+ | `push` | `p` `pu` | Push after the commit succeeds |
367
+ | `scope` | `s` | Force a scope: `type(scope): message` (useful with fast mode) |
368
+ | `no-split` | `nsp` `nsl` | Disable automatic split detection for this commit |
369
+ | `ai` | `i` `llm` | Generate the commit message with AI |
370
+ | `msg` | `m` | Open `$EDITOR` for a multiline message body |
371
+ | `ticket` | `t` `j` `jira` | Append ticket info to the header |
372
+
373
+ **Examples**
374
+
375
+ | Command | What it does |
376
+ |---------|--------------|
377
+ | `gitb commit` | Interactive commit |
378
+ | `gitb commit fast` | `git add .` then enter a message |
379
+ | `gitb commit ai fast push` | AI message + add all + commit + push |
380
+ | `gitb commit aifp` | Same as above (compact form) |
381
+ | `gitb commit ai split push` | AI groups staged files into commits, then push |
382
+ | `gitb commit fixup push` | Pick an older commit, fixup it, then push |
383
+ | `gitb commit amend fast` | Add all current changes into the last commit |
384
+ | `gitb commit ff` | Full auto: AI splits and writes everything |
385
+
386
+ **How modes combine**
387
+ - Word order doesn't matter: `ai fast push` == `push fast ai` == `aifp`.
388
+ - Modifiers stack on actions: `ai+fixup`, `fast+amend`, `split+push`, `ai+staged`, …
389
+ - `fast` and `staged` are mutually exclusive (one stages all, the other uses what's staged).
390
+ - `revert` and `ff` only accept `push` (as `revp` / `ffp`); to rewrite the last commit message use [`gitb edit`](#gitb-edit).
391
+
392
+ ### `gitb edit`
393
+
394
+ Rewrites a **commit message** or the **current branch name** without touching the tree.
395
+
213
396
  ```bash
214
- gitb cfg proxy
215
- # Examples:
216
- # http://proxy.example.com:8080
217
- # http://username:password@proxy.example.com:8080
397
+ gitb edit # reword the LAST commit (git commit --amend)
398
+ gitb edit pick # choose any recent commit and reword it via rebase
399
+ gitb edit branch # rename the current branch (interactive)
400
+ gitb edit branch feat/new-name # rename the current branch to feat/new-name
401
+ gitb edit help # show inline help
218
402
  ```
219
403
 
220
- ### AI Command Examples
404
+ Modes:
405
+
406
+ | Mode | Aliases | Description |
407
+ |------|---------|-------------|
408
+ | `<empty>` | | Reword the last commit (`git commit --amend`) |
409
+ | `pick` | `p` `c` `choose` | Pick any recent commit, reword via non-interactive rebase |
410
+ | `branch` | `b` `br` `rename` `ren` | Rename the current branch (`git branch -m`); optional remote sync |
411
+ | `help` | `h` `--help` `-h` | Show inline help |
412
+
413
+ Notes:
414
+
415
+ - `pick` requires a clean working tree (the rebase replays subsequent commits).
416
+ - Merge commits and the root commit cannot be reworded this way.
417
+ - If the commit was already pushed, run `gitb push force` afterwards.
418
+ - `branch` offers to push the new name and delete the old one on the remote when an upstream exists.
419
+ - To add staged changes into the last commit, use `gitb commit amend` instead.
420
+ - To undo the change, use `gitb undo amend` (for plain edit) or `gitb undo rebase` (for `pick`).
421
+
422
+ ### `gitb push`
423
+
424
+ <details>
425
+ <summary>All push modes</summary>
426
+
427
+ | Mode | Aliases | Description |
428
+ |------|---------|-------------|
429
+ | `<empty>` | | Show commits, push with conflict handling |
430
+ | `yes` | `y` | Push without confirmation |
431
+ | `force` | `f` | Force push (use after rebase/amend) |
432
+ | `list` | `log` `l` | List unpushed commits only |
433
+
434
+ </details>
435
+
436
+ ### `gitb pull`
221
437
 
222
- | **Scenario** | **Command** | **What It Does** |
223
- |--------------|-------------|------------------|
224
- | **Staged files ready** | `gitb c ai` | Analyzes staged changes, generates message |
225
- | **Quick fix needed** | `gitb c aif` | Adds all files + AI message |
226
- | **Ready to ship** | `gitb c aip` | AI commit + automatic push |
227
- | **Full workflow** | `gitb c aifp` | Add all + AI commit + push |
228
- | **Need control** | `gitb c ais` | AI message + manual type/scope |
229
- | **Detailed commit** | `gitb c aim` | Generates multiline commit message |
438
+ <details>
439
+ <summary>All pull modes</summary>
230
440
 
231
- ## Common Workflows
441
+ | Mode | Aliases | Description |
442
+ |------|---------|-------------|
443
+ | `<empty>` | | Smart pull (strategy picker) |
444
+ | `fetch` | `fe` | Fetch only |
445
+ | `all` | `fa` | Fetch all branches |
446
+ | `upd` | `u` | Update remote refs / prune |
447
+ | `ffonly` | `ff` | Fast-forward only |
448
+ | `merge` | `m` | Always create merge commit |
449
+ | `rebase` | `r` | Rebase current onto remote |
450
+ | `interactive` | `ri` `rs` | Interactive rebase + autosquash |
451
+ | `dry` | `d` `dr` | Preview incoming commits without modifying local refs |
232
452
 
233
- ### 🔄 Daily Development Workflow
453
+ </details>
234
454
 
235
- ```bash
236
- # Start your day
237
- gitb st # Check repository status
238
- gitb pu # Pull latest changes
455
+ ### `gitb branch`
239
456
 
240
- # Work on features
241
- gitb b n # Create new feature branch
242
- # ... code changes ...
243
- gitb c ai # AI-powered commit
244
- gitb p # Push changes
457
+ <details>
458
+ <summary>All branch modes</summary>
245
459
 
246
- # Code review cycle
247
- gitb c fix # Create fixup commits
248
- gitb r a # Clean up with autosquash
249
- gitb p f # Force push cleaned history
250
- ```
460
+ | Mode | Aliases | Description |
461
+ |------|---------|-------------|
462
+ | `<empty>` | | Pick a local branch to switch |
463
+ | `list` | `l` | List local branches |
464
+ | `remote` | `re` `r` | Fetch and switch to a remote branch |
465
+ | `main` | `def` `m` | Quick-switch to default branch |
466
+ | `tag` | `t` | Checkout to a specific tag |
467
+ | `new` | `n` `c` | Create branch from current |
468
+ | `newd` | `nd` `cd` | Switch to main, pull, branch off |
469
+ | `delete` | `del` `d` | Delete branches (orphaned, merged, or selected) |
470
+ | `prev` | `p` `-` | Switch to previous branch (`cd -`) |
471
+ | `recent` | `rc` | Pick from recently checked-out branches |
472
+ | `gone` | `g` | Delete locals whose remote tracking branch is gone |
473
+
474
+ </details>
475
+
476
+ ### `gitb tag`
477
+
478
+ <details>
479
+ <summary>All tag modes</summary>
480
+
481
+ | Mode | Aliases | Description |
482
+ |------|---------|-------------|
483
+ | `<empty>` | | Lightweight tag from `HEAD` |
484
+ | `annotated` | `a` `an` | Annotated tag with message |
485
+ | `commit` | `c` `co` `cm` | Tag from a selected commit |
486
+ | `all` | `al` | Annotated tag from selected commit |
487
+ | `push` | `p` `ps` `ph` | Push a tag |
488
+ | `push-all` | `pa` | Push all tags |
489
+ | `delete` | `del` `d` | Delete a local tag |
490
+ | `delete-all` | `da` | Delete all local tags |
491
+ | `list` | `log` `l` | List local tags |
492
+ | `remote` | `fetch` `r` | Fetch and list remote tags |
493
+
494
+ </details>
495
+
496
+ ### `gitb merge`
497
+
498
+ <details>
499
+ <summary>All merge modes</summary>
500
+
501
+ | Mode | Aliases | Description |
502
+ |------|---------|-------------|
503
+ | `<empty>` | | Pick a branch to merge into current |
504
+ | `main` | `master` `m` | Merge default branch into current |
505
+ | `to-main` | `to-master` `tm` | Switch to main, merge current branch in |
506
+ | `remote` | `r` | Fetch + select a remote branch to merge |
507
+
508
+ </details>
509
+
510
+ ### `gitb rebase`
511
+
512
+ <details>
513
+ <summary>All rebase modes</summary>
514
+
515
+ | Mode | Aliases | Description |
516
+ |------|---------|-------------|
517
+ | `<empty>` | | Pick a base branch |
518
+ | `main` | `master` `m` | Rebase current onto default |
519
+ | `interactive` | `i` | Interactive rebase from picked commit |
520
+ | `autosquash` | `a` `s` `ia` | Interactive rebase with `--autosquash` |
521
+ | `fastautosquash` | `fast` `sf` `f` | Autosquash without interaction |
522
+ | `pull` | `p` | Take commits from selected branch into current |
523
+
524
+ </details>
525
+
526
+ ### `gitb squash`
527
+
528
+ Ask the AI to read commits in the current branch's range and propose a clean,
529
+ changelog-ready history (e.g. fold five `fix typo`/`wip` commits into the one
530
+ feature commit they belong to). Range is auto-detected:
531
+
532
+ - On the **default branch** — commits since the last tag.
533
+ - On any **other branch** — commits since the merge-base with the default branch.
534
+
535
+ The plan is shown for confirmation before any history is rewritten. If you
536
+ don't like the result, recover with `gitb undo rebase`.
537
+
538
+ <details>
539
+ <summary>All squash modes</summary>
540
+
541
+ | Mode | Aliases | Description |
542
+ |------|---------|-------------|
543
+ | `<empty>` | | Generate plan, confirm, then interactive rebase |
544
+ | `preview` | `p` `dry` `show` | Show the AI plan only — don't touch history |
545
+ | `yes` | `y` `fast` | Apply without the confirmation prompt |
546
+ | `push` | `ps` | After rebase, force-push with `--force-with-lease` |
547
+ | `help` | `h` | Show usage |
548
+
549
+ </details>
550
+
551
+ Requires AI to be configured (`gitb cfg ai`).
552
+
553
+ ### `gitb cherry`
554
+
555
+ <details>
556
+ <summary>All cherry modes</summary>
557
+
558
+ | Mode | Aliases | Description |
559
+ |------|---------|-------------|
560
+ | `<empty>` | | Pick commits from a branch interactively |
561
+ | `<commit-hash>` | | Shorthand for cherry-pick by hash |
562
+ | `hash` | `hs` | Cherry-pick a specific hash |
563
+ | `range` | `r` | Cherry-pick a range (`A..B`) |
564
+ | `abort` | `a` | Abort current cherry-pick |
565
+ | `continue` | `cont` `c` | Continue after resolving conflicts |
566
+
567
+ </details>
568
+
569
+ ### `gitb sync`
570
+
571
+ Fetch the default branch and update your current branch. Useful mid-feature.
572
+
573
+ <details>
574
+ <summary>All sync modes</summary>
251
575
 
252
- ### 🚨 Hotfix Workflow
576
+ | Mode | Aliases | Description |
577
+ |------|---------|-------------|
578
+ | `<empty>` | | Fetch main + rebase current onto it |
579
+ | `push` | `p` | …then force-push |
580
+ | `merge` | `m` | Use merge instead of rebase |
581
+ | `mergep` | `mp` `pm` | Merge + push |
582
+ | `dry` | `d` `dr` | Preview commits sync would bring in from main without modifying local refs |
583
+
584
+ </details>
585
+
586
+ ### `gitb wip`
587
+
588
+ Save work-in-progress through one of three backends and restore it later. Pick
589
+ the one that fits the situation — `wip up` prompts when the backend isn't
590
+ specified, and `wip down` auto-detects which backend was used.
591
+
592
+ | Backend | What it does | When to use |
593
+ |---------|--------------|-------------|
594
+ | `stash` | `git stash --include-untracked` + force-push `wip/<branch>` to remote as backup | Quick context switch, default |
595
+ | `branch` | Commits all changes onto a `wip/<branch>` branch, leaves current branch clean, optionally pushes | Want history / share work / open a draft PR |
596
+ | `worktree` | Same as branch, but the WIP lives in a sibling worktree so you can keep working on it side-by-side | Long-running parallel work |
597
+
598
+ <details>
599
+ <summary>All wip up / down modes</summary>
600
+
601
+ | Command | Aliases | Description |
602
+ |---------|---------|-------------|
603
+ | `gitb wip up` | `u` | Save WIP — prompts which backend to use |
604
+ | `gitb wip up stash` | `u s` | Stash + push backup branch |
605
+ | `gitb wip up branch` | `u b` | Commit onto `wip/<branch>` + push |
606
+ | `gitb wip up worktree` | `u w` `u wt` | Move WIP into a sibling worktree |
607
+ | `gitb wip up <mode> nopush` | `np` `n` | Skip the push step (works with any backend) |
608
+ | `gitb wip up nopush` | `u np` `u n` | Legacy: stash + no push (same as `up stash nopush`) |
609
+ | `gitb wip down` | `d` | Restore — auto-detects backend, prompts if ambiguous |
610
+ | `gitb wip down stash` | `d s` | Restore from the stash |
611
+ | `gitb wip down branch` | `d b` | Restore from `wip/<branch>` (squash-merge into working tree) |
612
+ | `gitb wip down worktree` | `d w` `d wt` | Restore from the wip worktree, then remove it |
613
+
614
+ </details>
615
+
616
+ For `branch` and `worktree`, `wip down` brings everything (committed + uncommitted) back as plain modifications and deletes the wip branch / worktree (and remote `wip/<branch>` if present).
617
+
618
+ ### `gitb undo`
619
+
620
+ <details>
621
+ <summary>All undo modes</summary>
622
+
623
+ | Mode | Aliases | Description |
624
+ |------|---------|-------------|
625
+ | `<empty>` / `commit` | `c` | Undo last commit (`reset --soft HEAD~1`) — keeps changes staged |
626
+ | `amend` | `a` | Restore pre-amend state via reflog |
627
+ | `merge` | `m` | Abort or undo last merge |
628
+ | `rebase` | `r` | Abort or undo last rebase (`ORIG_HEAD`) |
629
+ | `stash` | `s` | Re-stash a popped/applied stash |
630
+
631
+ </details>
632
+
633
+ ### `gitb reset`
634
+
635
+ <details>
636
+ <summary>All reset modes</summary>
637
+
638
+ | Mode | Aliases | Description |
639
+ |------|---------|-------------|
640
+ | `<empty>` | | Preview and reset last commit (mixed) |
641
+ | `soft` | `s` | Preview and soft reset last commit |
642
+ | `undo` | `u` | Preview and undo last reset |
643
+ | `interactive` | `i` | Pick commit to reset to, then approve |
644
+ | `ref` | `r` | Reset to a `HEAD` reference with approval (reflog recovery) |
645
+
646
+ </details>
647
+
648
+ ### `gitb stash`
649
+
650
+ <details>
651
+ <summary>All stash modes</summary>
652
+
653
+ | Mode | Aliases | Description |
654
+ |------|---------|-------------|
655
+ | `<empty>` | | Interactive stash menu |
656
+ | `select` | `sel` | Stash specific files |
657
+ | `all` | | Stash everything including untracked |
658
+ | `list` | `l` | List all stashes |
659
+ | `pop` | `p` | Apply and remove |
660
+ | `show` | `s` | Preview stash |
661
+ | `apply` | `a` | Apply without removing |
662
+ | `drop` | `d` | Delete stash |
663
+
664
+ </details>
665
+
666
+ ### `gitb worktree`
667
+
668
+ Run multiple branches in parallel without stashing or switching: each worktree
669
+ is a real working directory linked to the same `.git`. Great for hotfixes,
670
+ long-running reviews, or comparing branches side-by-side.
671
+
672
+ <details>
673
+ <summary>All worktree modes</summary>
674
+
675
+ | Mode | Aliases | Description |
676
+ |------|---------|-------------|
677
+ | `<empty>` | | Show existing worktrees + interactive menu |
678
+ | `list` | `l` `ls` | List all worktrees with branch and lock state |
679
+ | `add` | `a` `new` `n` `c` | Create worktree with a new branch from current `HEAD` |
680
+ | `addd` | `ad` `nd` `cd` | Fetch, then create worktree with new branch from default branch |
681
+ | `addb` | `ab` `from` `b` | Create worktree from an existing local branch |
682
+ | `addr` | `ar` `remote` `r` | Fetch + create worktree tracking a remote branch |
683
+ | `remove` | `rm` `del` `d` | Pick a worktree to remove (force-prompt on dirty trees) |
684
+ | `move` | `mv` | Move a worktree to a new path |
685
+ | `lock` | | Lock a worktree (with optional reason) |
686
+ | `unlock` | `ul` | Unlock a worktree |
687
+ | `prune` | `pr` `p` | Clean up stale worktree records (dry-run preview first) |
688
+ | `path` | `cd` `switch` `sw` | Print the path to a chosen worktree (use with `cd $(...)`) |
689
+
690
+ </details>
253
691
 
254
692
  ```bash
255
- gitb b main # Switch to main branch
256
- gitb pu # Get latest changes
257
- gitb b n # Create hotfix branch
258
- # ... fix the issue ...
259
- gitb c aif # Fast AI commit
260
- gitb p # Push hotfix
261
- gitb m to-main # Merge to main
693
+ gitb wt add # new branch + new worktree from current HEAD
694
+ gitb wt addd # new branch + new worktree from updated main
695
+ gitb wt addr # check out a remote branch into a fresh worktree
696
+ gitb wt remove # interactive removal (with force prompt if dirty)
697
+ cd "$(gitb wt path)" # cd into a chosen worktree
262
698
  ```
263
699
 
264
- ### 🔀 Feature Integration
700
+ By default new worktrees are created at `../<repo>-<branch>`. Override the
701
+ parent directory globally or per-repo:
265
702
 
266
703
  ```bash
267
- # Prepare feature for merge
268
- gitb pu # Update current branch
269
- gitb r main # Rebase on main
270
- gitb l # Review commit history
271
- gitb c fix # Address review feedback
272
- gitb r a # Squash fixups
704
+ git config --global gitbasher.worktreebase ~/code/worktrees
705
+ ```
706
+
707
+ ### `gitb hook`
708
+
709
+ <details>
710
+ <summary>All hook modes</summary>
711
+
712
+ | Mode | Aliases | Description |
713
+ |------|---------|-------------|
714
+ | `<empty>` | | Interactive action menu |
715
+ | `list` | `l` | All hooks with status |
716
+ | `create` | `new` `c` | New hook from templates |
717
+ | `edit` | `e` | Edit existing hook |
718
+ | `toggle` | `t` | Enable/disable hook |
719
+ | `remove` | `rm` `r` | Delete hook(s) |
720
+ | `test` | `run` `check` | Test hook execution |
721
+ | `show` | `cat` `view` `s` | Display hook contents |
722
+
723
+ </details>
724
+
725
+ ### `gitb init`
273
726
 
274
- # Integrate
275
- gitb m to-main # Merge to main
276
- gitb b del # Clean up feature branch
727
+ Initialize a new git repository and (optionally) add a remote origin.
728
+
729
+ ```bash
730
+ gitb init # git init + interactive remote prompt
731
+ gitb origin set <url> # add origin without prompts
277
732
  ```
278
733
 
279
- ### 🎯 Release Workflow
734
+ `gitb init` runs `git init` in the current directory. If the repo has no
735
+ configured remote, gitbasher offers to add one interactively. Use
736
+ [`gitb origin`](#gitb-origin) for non-interactive remote management.
737
+
738
+ ### `gitb origin`
739
+
740
+ Add, change, rename, or remove the remote origin. Useful when you create a repo
741
+ without a remote, rename the repo on GitHub/GitLab, or move it to a new host.
742
+
743
+ <details>
744
+ <summary>All origin modes</summary>
745
+
746
+ | Mode | Aliases | Description |
747
+ |------|---------|-------------|
748
+ | `<empty>` | `show` `info` | List configured remotes and their URLs |
749
+ | `set` | `add` `new` `a` | Add a new origin (errors if origin already set) |
750
+ | `change` | `update` `c` `u` `set-url` | Change the existing origin URL (after rename/move) |
751
+ | `rename` | `mv` `ren` | Rename a remote (e.g. `origin` → `upstream`) |
752
+ | `remove` | `rm` `del` `d` | Remove the remote |
753
+ | `help` | `h` | Show help |
754
+
755
+ </details>
756
+
757
+ Each mutating mode accepts an optional URL/name as a second argument to skip
758
+ the interactive prompt:
280
759
 
281
760
  ```bash
282
- gitb b main # Switch to main
283
- gitb pu # Get latest changes
284
- gitb l # Review changes since last release
285
- gitb t a # Create annotated release tag
286
- gitb t push # Push tag to trigger CI/CD
761
+ gitb origin # show remotes
762
+ gitb origin set git@github.com:me/proj.git # add origin
763
+ gitb origin change https://github.com/me/new.git # update URL after rename
764
+ gitb origin rename upstream # origin → upstream
765
+ gitb origin remove # delete the remote
287
766
  ```
288
767
 
289
- ### 🛠️ Maintenance Workflow
768
+ ### `gitb config`
769
+
770
+ <details>
771
+ <summary>All config modes</summary>
772
+
773
+ | Mode | Aliases | Description |
774
+ |------|---------|-------------|
775
+ | `<empty>` | | Show current configuration |
776
+ | `user` | `u` `name` `email` | Set name and email |
777
+ | `default` | `def` `d` `b` `main` | Set default branch |
778
+ | `separator` | `sep` `s` | Branch-name separator |
779
+ | `editor` | `ed` `e` | Commit-message editor |
780
+ | `ticket` | `ti` `t` `jira` | Ticket prefix for commits/branches |
781
+ | `scopes` | `sc` `s` | Common scopes |
782
+ | `ai` | `llm` `key` | AI API key |
783
+ | `provider` | `prov` | AI provider (openrouter, openai, ollama) |
784
+ | `model` | `m` | Default AI model |
785
+ | `proxy` | `prx` `p` | HTTP proxy for AI calls |
786
+ | `completion` | `comp` | Install / uninstall bash & zsh tab completion |
787
+ | `delete` | `unset` `del` | Remove global config |
788
+
789
+ </details>
790
+
791
+ ### `gitb log`
792
+
793
+ <details>
794
+ <summary>All log modes</summary>
795
+
796
+ | Mode | Aliases | Description |
797
+ |------|---------|-------------|
798
+ | `<empty>` | | Pretty log for current branch |
799
+ | `branch` | `b` | Pick a branch to log |
800
+ | `compare` | `comp` `c` | Compare two branches |
801
+ | `search` | `s` | Search commits |
802
+
803
+ **Search sub-modes:** `message`/`msg`/`m`, `author`/`a`, `file`/`f`, `content`/`pickaxe`/`p`, `date`/`d`, `hash`/`commit`/`h`.
804
+
805
+ </details>
806
+
807
+ ### Info commands
808
+
809
+ | Command | Aliases | Description |
810
+ |---------|---------|-------------|
811
+ | `status` | `s` | Repo info and changed files |
812
+ | `reflog` | `rl` `rlg` | Pretty reflog |
813
+ | `last-commit` | `lc` `lastc` | Show the last commit |
814
+ | `last-ref` | `lr` `lastr` | Show the last reference |
815
+
816
+ ---
290
817
 
818
+ ## Configuration
819
+
820
+ `gitb cfg` (no args) prints the active configuration. Settings live in standard `git config`, so they're per-repo by default — use `--global` for everywhere.
821
+
822
+ | Key | Set via | Purpose |
823
+ |-----|---------|---------|
824
+ | `user.name` / `user.email` | `gitb cfg user` | Your identity |
825
+ | `gitbasher.branch` | `gitb cfg default` | Default branch (`main`, `master`, …) |
826
+ | `gitbasher.sep` | `gitb cfg separator` | Branch-name separator (`/`, `-`, …) |
827
+ | `gitbasher.editor` | `gitb cfg editor` | Editor for messages |
828
+ | `gitbasher.ticket` | `gitb cfg ticket` | Ticket prefix (`PROJ-`) |
829
+ | `gitbasher.scopes` | `gitb cfg scopes` | Suggested commit scopes |
830
+ | `gitbasher.ai-api-key` | `gitb cfg ai` | AI provider API key (or `GITB_AI_API_KEY` env) |
831
+ | `gitbasher.ai-provider` | `gitb cfg provider` | `openrouter` (default), `openai`, or `ollama` |
832
+ | `gitbasher.ai-base-url` | `git config` | Custom OpenAI-compatible endpoint (LiteLLM, vLLM, remote Ollama) |
833
+ | `gitbasher.ai-model[-task]` | `gitb cfg model` | AI model overrides (per provider) |
834
+ | `gitbasher.proxy` | `gitb cfg proxy` | HTTP proxy for AI calls |
835
+ | `gitbasher.worktreebase` | `git config gitbasher.worktreebase <dir>` | Parent directory for new worktrees (defaults to `..`) |
836
+
837
+ **Clear gitbasher config** (per-repo settings live with the repo and disappear with it):
291
838
  ```bash
292
- # Clean up old branches
293
- gitb b del # Interactive branch deletion
294
-
295
- # Manage stashes
296
- gitb stash # Interactive stash management
297
-
298
- # Check hooks
299
- gitb hook list # See all git hooks status
300
- gitb hook create # Set up project hooks
301
- ```
302
-
303
-
304
- ## Complete Documentation
305
-
306
- ### Available Commands
307
-
308
- | Command | Short aliases | Description |
309
- |---------------------------------|---------------------|------------------------------------------|
310
- | [**commit**](#gitb-commit-mode) | `c` `co` `com` | Everything about commit creation |
311
- | [**push**](#gitb-push-mode) | `p` `ps` `ph` | Pushing changes to a remote repository |
312
- | [**pull**](#gitb-pull-mode) | `pu` `pl` `pul` | Pulling changes from a remote repository |
313
- | [**branch**](#gitb-branch-mode) | `b` `br` `bran` | Managing branches |
314
- | [**tag**](#gitb-tag-mode) | `t` `tg` | Managing tags |
315
- | [**merge**](#gitb-merge-mode) | `m` `me` | Merge changes to the current branch |
316
- | [**rebase**](#gitb-rebase-mode) | `r` `re` `base` | Rebase current branch |
317
- | [**reset**](#gitb-reset-mode) | `res` | Easy to use git reset |
318
- | [**stash**](#gitb-stash-mode) | `s` `sta` | Manage git stashes |
319
- | [**hook**](#gitb-hook-mode) | `ho` `hk` | Comprehensive git hooks management with interactive menus |
320
- | [**config**](#gitb-config-mode) | `cf` `cfg` `conf` | Configurate gitbasher |
321
- | **status** | `st` | Info about repo and changed files |
322
- | [**log**](#gitb-log-mode) | `l` `lg` | Git log utilities and search functions |
323
- | **reflog** | `rl` `rlg` | Open git reflog in a pretty format |
324
- | **help** | `h` `man` | Show help |
325
-
326
-
327
- ### `gitb commit <mode>`
328
-
329
- | **Mode** | **Short** | **Description** | **Example Use Case** |
330
- |------------|--------------|-----------------|---------------------|
331
- | `<empty>` | | Select files to commit and create conventional message | Regular feature development |
332
- | `msg` | `m` | Create multiline commit message using text editor | Detailed commit descriptions |
333
- | `ticket` | `t` | Add tracker's ticket info to commit header | JIRA/GitHub issue integration |
334
- | `fast` | `f` | Add all files and create commit without scope | Quick bug fixes |
335
- | `fasts` | `fs` | Add all files and create commit with scope | Feature additions |
336
- | `push` | `pu` `p` | Create commit and push changes | Deploy-ready commits |
337
- | `fastp` | `fp` | Fast commit and push | One-command workflow |
338
- | `fastsp` | `fsp` `fps` | Fast commit with scope and push | Complete feature deployment |
339
- | `ai` | `llm` `i` | AI-generated commit message | Smart commit automation |
340
- | `aif` | `llmf` `if` | Fast AI commit without confirmation | Rapid development |
341
- | `aip` | `llmp` `ip` | AI commit and push | AI-powered deployment |
342
- | `aifp` | `llmfp` `ifp` | Fast AI commit with push | Complete AI workflow |
343
- | `ais` | `llms` `is` | AI summary with manual type/scope | Controlled AI assistance |
344
- | `aim` | `llmm` `im` | AI multiline commit message | Detailed AI documentation |
345
- | `fixup` | `fix` `x` | Create fixup commit for rebase | Code review fixes |
346
- | `fixupp` | `fixp` `xp` | Fixup commit and push | Remote fixup commits |
347
- | `fastfix` | `fx` | Fast fixup all files | Quick fixup workflow |
348
- | `fastfixp` | `fxp` | Fast fixup and push | Complete fixup deployment |
349
- | `amend` | `am` `a` | Add files to last commit | Forgot to include files |
350
- | `amendf` | `amf` `af` | Amend with all files | Complete last commit |
351
- | `last` | `l` | Change last commit message | Fix commit message typos |
352
- | `revert` | `rev` | Revert selected commit | Undo problematic changes |
353
-
354
- ### `gitb push <mode>`
355
-
356
- | **Mode** | **Short** | **Description** | **When to Use** |
357
- |-----------|-----------|-----------------|-----------------|
358
- | `<empty>` | | Show commits and push with conflict handling | Regular push workflow |
359
- | `yes` | `y` | Push without confirmation | Automated scripts |
360
- | `force` | `f` | Force push (use with caution) | After rebase/amend |
361
- | `list` | `log` `l` | Show unpushed commits only | Review before push |
362
-
363
- ### `gitb pull <mode>`
364
-
365
- | **Mode** | **Short** | **Description** | **Best For** |
366
- |---------------|------------|-----------------|--------------|
367
- | `<empty>` | | Smart pull with strategy selection | Daily workflow |
368
- | `fetch` | `fe` | Fetch only, no merge | Review changes first |
369
- | `all` | `fa` | Fetch all branches | Sync repository |
370
- | `upd` | `u` | Update all remote references | Branch cleanup |
371
- | `ffonly` | `ff` | Fast-forward only merge | Linear history |
372
- | `merge` | `m` | Always create merge commit | Feature branches |
373
- | `rebase` | `r` | Rebase current branch | Clean history |
374
- | `interactive` | `ri` `rs` | Interactive rebase with autosquash | Commit cleanup |
375
-
376
- ### `gitb branch <mode>`
377
-
378
- | **Mode** | **Short** | **Description** | **Use Case** |
379
- |-----------|------------|-----------------|--------------|
380
- | `<empty>` | | Interactive branch selection | Switch branches |
381
- | `list` | `l` | Show local branches | Branch overview |
382
- | `remote` | `re` `r` | Switch to remote branch | Work on others' branches |
383
- | `main` | `def` `m` | Quick switch to main | Back to main branch |
384
- | `new` | `n` `c` | Create branch from current | Feature from current state |
385
- | `newd` | `nd` | Create branch from updated main | New feature branch |
386
- | `delete` | `del` `d` | Delete local branch | Cleanup merged branches |
387
-
388
- ### `gitb tag <mode>`
389
-
390
- | **Mode** | **Short** | **Description** | **Perfect For** |
391
- |--------------|-----------------|---------------------------------------------------------|-----------------|
392
- | `<empty>` | | Create new tag from last commit | Quick releases |
393
- | `annotated` | `a` `an` | Create annotated tag with message | Official releases |
394
- | `commit` | `c` `co` `cm` | Create tag from selected commit | Retrospective tagging |
395
- | `all` | `al` | Create annotated tag from selected commit | Complex releases |
396
- | `push` | `ps` `ph` `p` | Push local tag to remote | Deploy releases |
397
- | `push-all` | `pa` | Push all tags to remote | Sync all releases |
398
- | `delete` | `del` `d` | Delete local tag | Fix tag mistakes |
399
- | `delete-all` | `da` | Delete all local tags | Clean slate |
400
- | `list` | `log` `l` | Show local tags | Review releases |
401
- | `remote` | `fetch` `r` | Fetch and show remote tags | Check remote releases |
402
-
403
- ### `gitb merge <mode>`
404
-
405
- | **Mode** | **Short** | **Description** | **When to Use** |
406
- |-----------|-----------|-----------------------------------------------------------------|--------------|
407
- | `<empty>` | | Select branch to merge with conflict resolution | Feature integration |
408
- | `main` | `m` | Merge main into current branch | Update feature branch |
409
- | `to-main` | `tm` | Switch to main and merge current branch | Complete feature |
410
-
411
- ### `gitb rebase <mode>`
412
-
413
- | **Mode** | **Short** | **Description** | **Best For** |
414
- |---------------|---------------------|-------------------------------------------------------------------------------|--------------|
415
- | `<empty>` | | Select base branch for rebase | Branch updates |
416
- | `main` | `m` | Rebase current branch onto main | Linear history |
417
- | `interactive` | `i` | Interactive rebase from selected commit | History editing |
418
- | `autosquash` | `a` `s` `f` `ia` | Interactive rebase with fixup commits | Clean commit history |
419
-
420
- ### `gitb reset <mode>`
421
-
422
- | **Mode** | **Short** | **Description** | **Use Case** |
423
- |---------------|-----------|-------------------------------------------------------------------------|--------------|
424
- | `<empty>` | | Reset last commit (mixed mode) | Undo last commit, keep changes |
425
- | `soft` | `s` | Soft reset last commit | Redo commit message |
426
- | `undo` | `u` | Undo last reset operation | Recover from mistake |
427
- | `interactive` | `i` | Select commit to reset to | Go back multiple commits |
428
- | `ref` | `r` | Reset to selected HEAD reference | Use reflog recovery |
429
-
430
- ### `gitb stash <mode>`
431
-
432
- | **Mode** | **Short** | **Description** | **Perfect For** |
433
- |--------------|-----------|-----------------|-----------------|
434
- | `<empty>` | | Interactive stash menu | Explore all options |
435
- | `select` | `sel` | Stash specific files | Partial work saving |
436
- | `all` | | Stash everything including untracked | Complete state save |
437
- | `list` | `l` | View all stashes | Find specific stash |
438
- | `pop` | `p` | Apply and remove stash | Continue work |
439
- | `show` | `s` | Preview stash contents | Check before apply |
440
- | `apply` | `a` | Apply without removing | Keep stash backup |
441
- | `drop` | `d` | Delete stash | Cleanup unused stashes |
442
-
443
- ### `gitb hook <mode>`
444
-
445
- | **Mode** | **Short** | **Description** | **Use Case** |
446
- |--------------|-----------------|-----------------|--------------|
447
- | `<empty>` | | Interactive action menu | Explore all operations |
448
- | `list` | `l` | Show all hooks with status | Audit current setup |
449
- | `create` | `new` `c` | Create new hook with templates | Set up automation |
450
- | `edit` | `e` | Edit existing hook | Modify behavior |
451
- | `toggle` | `t` | Enable/disable hook | Temporary control |
452
- | `remove` | `rm` `r` | Delete hook(s) | Cleanup |
453
- | `test` | `run` `check` | Test hook execution | Verify functionality |
454
- | `show` | `cat` `view` `s`| Display hook contents | Review implementation |
455
-
456
- ### `gitb config <mode>`
457
-
458
- | **Mode** | **Short** | **Description** | **Example** |
459
- |-------------|-------------------------|-------------------------------------------------------------|-------------|
460
- | `<empty>` | | Show current gitbasher configuration | Check setup |
461
- | `user` | `u` `name` `email` | Set user name and email | Initial setup |
462
- | `default` | `def` `d` `b` `main` | Set default branch name | Project standards |
463
- | `separator` | `sep` `s` | Set branch name separator | Naming conventions |
464
- | `editor` | `ed` `e` | Set commit message editor | Personal preference |
465
- | `ticket` | `ti` `t` `jira` | Set ticket prefix for commits/branches | Issue tracking |
466
- | `scopes` | `sc` `s` | Set common scopes for commits | Project structure |
467
- | `ai` | `llm` `key` | Configure AI API key | Smart commits |
468
- | `proxy` | `prx` `p` | Set HTTP proxy for AI requests | Geographic restrictions |
469
- | `delete` | `unset` `del` | Remove global configuration | Reset settings |
470
-
471
- ### `gitb log <mode>`
472
-
473
- | **Mode** | **Short** | **Description** | **Great For** |
474
- |---------------|---------------|-----------------------------------------------------------------------|--------------|
475
- | `<empty>` | | Pretty git log for current branch | Review recent work |
476
- | `branch` | `b` | Select branch to view log | Compare branches |
477
- | `compare` | `comp` `c` | Compare logs between two branches | Merge preparation |
478
- | `search` | `s` | Search commits with various criteria | Find specific changes |
479
-
480
- #### Log Search Options
481
-
482
- | **Search Mode** | **Short** | **Description** | **Example Use** |
483
- |-----------------|-----------|-----------------------------------------------------------------------|--------------|
484
- | `message` | `msg` `m` | Search by commit message | Find feature commits |
485
- | `author` | `a` | Search by author name/email | Team member contributions |
486
- | `file` | `f` | Search commits affecting specific files | File history |
487
- | `content` | `pickaxe` `p` | Search by added/removed content | Code archaeology |
488
- | `date` | `d` | Search within date range | Release timeframes |
489
- | `hash` | `commit` `h` | Search by commit hash pattern | Specific commit lookup |
490
-
491
-
492
- ## Troubleshooting & FAQ
493
-
494
- ### 📋 Common Issues & Solutions
495
-
496
- #### ❓ "Command not found: gitb"
497
- ```bash
498
- # Check if gitb is installed
499
- which gitb
500
-
501
- # If not found, reinstall
502
- GITB_PATH=/usr/local/bin/gitb && \
503
- curl -SL https://github.com/maxbolgarin/gitbasher/releases/latest/download/gitb -o $GITB_PATH && \
504
- chmod +x $GITB_PATH
505
-
506
- # Alternative: Install to user directory
507
- mkdir -p ~/.local/bin
508
- GITB_PATH=~/.local/bin/gitb && \
509
- curl -SL https://github.com/maxbolgarin/gitbasher/releases/latest/download/gitb -o $GITB_PATH && \
510
- chmod +x $GITB_PATH
511
- # Add to PATH: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
512
- ```
513
-
514
- #### ❓ "Permission denied" when installing
515
- ```bash
516
- # Use sudo for system-wide installation
517
- sudo curl -SL https://github.com/maxbolgarin/gitbasher/releases/latest/download/gitb -o /usr/local/bin/gitb
518
- sudo chmod +x /usr/local/bin/gitb
519
-
520
- # Or install to user directory (no sudo needed)
521
- mkdir -p ~/.local/bin
522
- curl -SL https://github.com/maxbolgarin/gitbasher/releases/latest/download/gitb -o ~/.local/bin/gitb
523
- chmod +x ~/.local/bin/gitb
524
- ```
525
-
526
- #### ❓ AI features not working
527
- ```bash
528
- # Check if API key is configured
529
- gitb cfg
530
-
531
- # Set up API key
532
- gitb cfg ai
839
+ git config --global --remove-section gitbasher 2>/dev/null
840
+ git config --global --unset core.editor 2>/dev/null # only if you set it via gitb cfg editor
841
+ ```
842
+
843
+ **Aliases for shell users:**
844
+ ```bash
845
+ echo 'alias gc="gitb c"' >> ~/.bashrc
846
+ echo 'alias gp="gitb p"' >> ~/.bashrc
847
+ echo 'alias gpu="gitb pu"' >> ~/.bashrc
848
+ echo 'alias gb="gitb b"' >> ~/.bashrc
849
+ ```
533
850
 
534
- # Test with a simple commit
535
- echo "test" >> test.txt
536
- git add test.txt
537
- gitb c ai
851
+ **zsh tip:** if zsh autocorrects `gitb` → `git`, add `alias gitb='nocorrect gitb'` to `~/.zshrc`.
538
852
 
539
- # If in restricted region, set up proxy
540
- gitb cfg proxy
541
- # Example: http://proxy.example.com:8080
853
+ ---
854
+
855
+ ## Other install paths
856
+
857
+ ### System-wide install
858
+ ```bash
859
+ # system-wide install (sudo, /usr/local/bin)
860
+ curl -fsSL https://raw.githubusercontent.com/maxbolgarin/gitbasher/main/install.sh | bash -s -- --sudo
861
+ ```
862
+
863
+ ### Custom location
864
+ ```bash
865
+ GITB_DIR=/opt/bin curl -fsSL https://raw.githubusercontent.com/maxbolgarin/gitbasher/main/install.sh | bash
542
866
  ```
543
867
 
544
- #### ❓ "Bad substitution" or bash errors
868
+
869
+ ### Pin a release
545
870
  ```bash
546
- # Check bash version (needs 4.0+)
547
- bash --version
871
+ GITB_VERSION=v3.10.2 curl -fsSL https://raw.githubusercontent.com/maxbolgarin/gitbasher/main/install.sh | bash
872
+ ```
548
873
 
549
- # macOS: Install newer bash (and Homebrew if needed)
550
- # 1) Install Homebrew (if missing):
551
- /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
552
- # 2) Install bash:
553
- brew install bash
554
- # 3) Optional: make it your default shell (restart Terminal after):
555
- sudo sh -c 'echo /opt/homebrew/bin/bash >> /etc/shells' && chsh -s /opt/homebrew/bin/bash
874
+ ## Uninstall
556
875
 
557
- # Ubuntu/Debian: upgrade bash
558
- sudo apt update && sudo apt install --only-upgrade bash
876
+ ### One command (recommended)
877
+ ```bash
878
+ gitb uninstall
559
879
  ```
880
+ Lists every `gitbasher.*` key it will remove from your local + global git config and the binary path it will delete, then asks for confirmation. Detects npm installs and prints the right `npm uninstall -g gitbasher` command instead of touching `node_modules`.
560
881
 
561
- #### ❓ Git operations fail
882
+ ### Manual
883
+ If `gitb` is already gone from PATH:
562
884
  ```bash
563
- # Check git version (needs 2.23+)
564
- git --version
885
+ rm -f ~/.local/bin/gitb # default install location
886
+ sudo rm -f /usr/local/bin/gitb # if installed with --sudo
887
+ npm uninstall -g gitbasher # if installed via npm
565
888
 
566
- # Update git
567
- # macOS: brew install git
568
- # Ubuntu: sudo apt install git
569
- # Or download from: https://git-scm.com/downloads
889
+ # Wipe leftover gitbasher.* keys from git config
890
+ git config --global --remove-section gitbasher 2>/dev/null
891
+ git config --local --remove-section gitbasher 2>/dev/null # per repo
570
892
  ```
571
893
 
572
- ### 🔧 System Requirements
894
+ ---
573
895
 
574
- | **System** | **Bash** | **Git** | **Installation Method** |
575
- |------------|----------|---------|------------------------|
576
- | **Linux** | 4.0+ | 2.23+ | `apt install bash git` |
577
- | **macOS** | 4.0+ | 2.23+ | `brew install bash git` |
578
- | **Windows** | WSL | WSL | `wsl --install` then Linux steps |
896
+ ## Troubleshooting
579
897
 
580
- ### 💡 Pro Tips
898
+ <details>
899
+ <summary><b>Command not found: gitb</b></summary>
581
900
 
582
- #### 🎯 **Workflow Optimization**
583
901
  ```bash
584
- # Set up aliases for even faster usage
585
- echo 'alias gc="gitb c"' >> ~/.bashrc
586
- echo 'alias gp="gitb p"' >> ~/.bashrc
587
- echo 'alias gpu="gitb pu"' >> ~/.bashrc
588
- echo 'alias gb="gitb b"' >> ~/.bashrc
902
+ which gitb # check install location
903
+ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc # if installed to ~/.local/bin
589
904
  ```
905
+ Reinstall via npm (`npm install -g gitbasher`) or curl (see [install](#install-in-10-seconds)).
906
+ </details>
590
907
 
591
- ### 🆘 **Still Having Issues?**
908
+ <details>
909
+ <summary><b>Permission denied during install</b></summary>
592
910
 
593
- **Ask for help**: [Open an issue](https://github.com/maxbolgarin/gitbasher/issues) or contact [@maxbolgarin](https://t.me/maxbolgarin)
911
+ The default install goes to `~/.local/bin` (no sudo). For a system-wide install pass `--sudo`:
912
+ ```bash
913
+ curl -fsSL https://raw.githubusercontent.com/maxbolgarin/gitbasher/main/install.sh | bash -s -- --sudo
914
+ ```
915
+ </details>
594
916
 
595
- ### 🗑️ **Uninstall**
917
+ <details>
918
+ <summary><b>AI features not working</b></summary>
596
919
 
597
920
  ```bash
598
- # Remove gitbasher
599
- sudo rm /usr/local/bin/gitb
600
- # or
601
- rm ~/.local/bin/gitb
921
+ gitb cfg # check config
922
+ gitb cfg ai # set API key
923
+ gitb cfg proxy # in restricted regions
924
+ ```
925
+
926
+ If `gitb commit ai` hangs, returns `connection refused`, or times out:
927
+
928
+ - **Network reachability** — test the provider directly: `curl -fsSL https://api.openai.com/v1/models -H "Authorization: Bearer $OPENAI_API_KEY"` (or the equivalent for OpenRouter/Ollama). If that fails, gitbasher will too.
929
+ - **Corporate proxy / restricted region** — `gitb cfg proxy` accepts `host:port` or `protocol://host:port`. Verify with `curl -x "$proxy" https://api.openai.com`.
930
+ - **Local Ollama** — confirm the daemon is running (`curl http://localhost:11434/api/tags`). The default model must be pulled first (`ollama pull llama3`).
931
+ - **Stale or rotated key** — `gitb cfg ai` re-prompts; prefer the env-var path (`export GITB_AI_API_KEY_OPENAI=...`) over `git config` so a leaked repo doesn't carry the secret.
932
+ </details>
602
933
 
603
- # Remove configuration (optional)
604
- rm -rf ~/.gitbasher
934
+ <details>
935
+ <summary><b>"could not lock config file" / git config permission</b></summary>
936
+
937
+ `git config --global` writes to `~/.gitconfig`. If gitbasher reports `could not lock config file`:
938
+
939
+ ```bash
940
+ ls -la ~/.gitconfig # check ownership and permissions
941
+ sudo chown "$USER" ~/.gitconfig
942
+ chmod u+w ~/.gitconfig
943
+ rm -f ~/.gitconfig.lock # stale lock from a crashed git process
605
944
  ```
606
945
 
946
+ Per-repo settings live in `.git/config` and need write access to that file (`chmod u+w .git/config` if mounted read-only).
947
+ </details>
607
948
 
608
- ## Roadmap for v4
949
+ <details>
950
+ <summary><b>"Bad substitution" or bash errors</b></summary>
609
951
 
610
- 1. Add support of multi modes, e.g. `gitb c fastp` -> `gitb c fast push` to prevent from a lot of modes to support all combinations
611
- 2. Add more interactive menus, because it is difficult to remember all commands and modes
612
- 3. Add better error messages and settings for verbosity
613
- 4. Add more AI APIs providers
952
+ `bash --version` must be 4.0+.
614
953
 
615
- ## Testing
954
+ - macOS: `brew install bash` (and optionally make it default: `sudo sh -c 'echo /opt/homebrew/bin/bash >> /etc/shells' && chsh -s /opt/homebrew/bin/bash`)
955
+ - Ubuntu/Debian: `sudo apt update && sudo apt install --only-upgrade bash`
956
+ </details>
616
957
 
617
- **gitbasher** includes a comprehensive test suite using [BATS (Bash Automated Testing System)](https://github.com/bats-core/bats-core) to ensure code quality and prevent regressions during refactoring.
958
+ <details>
959
+ <summary><b>System requirements</b></summary>
618
960
 
619
- ### Running Tests
961
+ | OS | Bash | Git | Install |
962
+ |----|------|-----|---------|
963
+ | Linux | 4.0+ | 2.23+ | `apt install bash git` |
964
+ | macOS | 4.0+ | 2.23+ | `brew install bash git` |
965
+ | Windows | WSL | WSL | `wsl --install` then Linux steps |
966
+ </details>
620
967
 
621
- ```bash
622
- # Run all tests
623
- make test
968
+ <details>
969
+ <summary><b>Common git errors and what to run instead</b></summary>
624
970
 
625
- # Run a specific test file
626
- make test-file FILE=test_sanitization.bats
971
+ | git complains | gitbasher path |
972
+ |---------------|----------------|
973
+ | `error: failed to push some refs ... non-fast-forward` | `gitb pull` (rebase or merge interactively), then `gitb push` |
974
+ | `Your branch and 'origin/<branch>' have diverged` | `gitb sync` — rebase onto the remote tip after picking strategy |
975
+ | `error: Your local changes ... would be overwritten` | `gitb wip up` (stash / branch / worktree backend), pull, then `gitb wip down` |
976
+ | `fatal: refusing to merge unrelated histories` | `gitb merge` and confirm the unrelated-history prompt, or pick a different base |
977
+ | `fatal: Not possible to fast-forward, aborting.` | `gitb sync` and pick rebase, or `gitb merge` to create a merge commit |
978
+ | `error: cannot rebase: You have unstaged changes` | `gitb wip up` first, rebase, then `gitb wip down` |
979
+ | `Another git process seems to be running ... index.lock` | gitbasher detects this at startup and prompts to remove the stale lock |
980
+ | `error: pathspec '<branch>' did not match any file(s) known to git` | `gitb pull` to fetch, or `gitb b new <branch>` to create a fresh branch with a conventional name |
981
+ | `fatal: detached HEAD` after checkout | gitbasher warns before destructive ops in detached HEAD; use `gitb b` to switch to a real branch first |
982
+ | `gpg: signing failed` on commit | export `GPG_TTY=$(tty)` or run `gitb config` to disable signing per-repo |
627
983
 
628
- # Or use the test runner directly
629
- cd tests
630
- ./run_tests.sh
631
- ```
984
+ If you hit a confusing git error not listed here, run the same flow with `git` directly first — gitbasher passes git's stderr through unchanged, so the underlying message is the source of truth.
985
+ </details>
632
986
 
633
- ### Test Coverage
987
+ <details>
988
+ <summary><b>Uninstall</b></summary>
634
989
 
635
- - **115+ tests** across multiple test files
636
- - Input sanitization (security-critical)
637
- - Git operations (commit, push, pull, merge, rebase)
638
- - Branch management
639
- - Common utilities
990
+ ```bash
991
+ npm uninstall -g gitbasher # if installed via npm
992
+ sudo rm /usr/local/bin/gitb # if installed system-wide
993
+ rm -f ~/.local/bin/gitb # if installed per-user
994
+ rm -rf ~/.gitbasher # remove config (optional)
995
+ ```
996
+ </details>
640
997
 
641
- See [tests/README.md](tests/README.md) for detailed testing documentation.
998
+ **Still stuck?** [Open an issue](https://github.com/maxbolgarin/gitbasher/issues) or ping [@maxbolgarin](https://t.me/maxbolgarin) on Telegram.
642
999
 
643
- ## Contributing
1000
+ ---
644
1001
 
645
- If you'd like to contribute to **gitbasher**, make a fork and submit a pull request. You also can open an issue or text me on Telegram: https://t.me/maxbolgarin
1002
+ ## Contributing
646
1003
 
647
- ### Development Workflow
1004
+ PRs welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) for the dev setup, BATS test patterns, and commit-message conventions. Curious how the bundle is built or how scripts get sourced into one process? See [ARCHITECTURE.md](./ARCHITECTURE.md).
648
1005
 
649
- 1. Fork the repository
650
- 2. Create a feature branch
651
- 3. **Write tests first** for new functionality
652
- 4. Implement your changes
653
- 5. Run tests: `make test`
654
- 6. Ensure all tests pass
655
- 7. Submit a pull request
1006
+ ```bash
1007
+ make build # rebuild dist/gitb
1008
+ make test # run all 115+ tests
1009
+ make test-file FILE=test_sanitization.bats
1010
+ ```
656
1011
 
657
- #### Maintainers
1012
+ Workflow:
658
1013
 
659
- * [maxbolgarin](https://github.com/maxbolgarin)
1014
+ 1. Fork and create a feature branch
1015
+ 2. **Write tests first** (BATS, see [tests/README.md](tests/README.md))
1016
+ 3. Implement
1017
+ 4. `make test` — all tests must pass
1018
+ 5. Open a PR
660
1019
 
661
- #### License
1020
+ **Maintainer:** [@maxbolgarin](https://github.com/maxbolgarin)
662
1021
 
663
- The source code license is MIT, as described in the [LICENSE](./LICENSE) file.
1022
+ **License:** MIT — see [LICENSE](./LICENSE).