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