gitbasher 3.8.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Maksim Bolgarin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,663 @@
1
+ # gitbasher – simple **bash** utility that makes **git** easy to use
2
+
3
+
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
+
8
+ <picture>
9
+ <img src=".github/commit.gif" width="600" alt="commit example">
10
+ </picture>
11
+
12
+ ---
13
+
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.
15
+
16
+
17
+ ### Quick Installation (recommended)
18
+
19
+ ```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
24
+ ```
25
+
26
+ Or using npm:
27
+
28
+ ```bash
29
+ npm install -g gitbasher
30
+ ```
31
+
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)).
33
+
34
+
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)
44
+
45
+
46
+ ## Quick Start Guide
47
+
48
+ ### 1. First Steps
49
+ ```bash
50
+ # Navigate to any git repository
51
+ cd your-project
52
+
53
+ # See all available commands
54
+ gitb
55
+ ```
56
+
57
+ ### 2. Your First Commit
58
+ ```bash
59
+ # Smart commit - select files and create conventional message
60
+ gitb commit
61
+
62
+ # Fast commit - add all files with quick message
63
+ gitb commit fast
64
+
65
+ # AI-powered commit (after setting up API key)
66
+ gitb commit ai
67
+ ```
68
+
69
+ ### 3. Essential Daily Commands
70
+ ```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
76
+ ```
77
+
78
+ ### 4. Set Up Your Environment
79
+ ```bash
80
+ # Configure your identity
81
+ gitb cfg user
82
+
83
+ # Set default branch (usually 'main' or 'master')
84
+ gitb cfg default
85
+
86
+ # Set up AI features (optional but recommended)
87
+ gitb cfg ai
88
+ ```
89
+
90
+
91
+ ## Why You Should Try This
92
+
93
+ **gitbasher** is essential if you use `git` on the daily basis. Benefits you will get:
94
+
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
101
+
102
+ <picture>
103
+ <img src=".github/push.gif" width="600" alt="push example">
104
+ </picture>
105
+
106
+
107
+ ## Real-World Examples
108
+
109
+ ### 🚀 Scenario 1: Starting a New Feature
110
+
111
+ **Traditional Git:**
112
+ ```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
120
+ ```
121
+
122
+ **With gitbasher:**
123
+ ```bash
124
+ gitb branch newd # Create new branch from updated main
125
+ # ... make changes ...
126
+ gitb commit push # Smart commit + push
127
+ ```
128
+
129
+ ### 🐛 Scenario 2: Quick Bug Fix
130
+
131
+ **Traditional Git:**
132
+ ```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
137
+ ```
138
+
139
+ **With gitbasher:**
140
+ ```bash
141
+ gitb commit push # Fast commit + push (one command!)
142
+ ```
143
+
144
+ ### 🔀 Scenario 3: Merging Feature Branch
145
+
146
+ **Traditional Git:**
147
+ ```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
153
+ ```
154
+
155
+ **With gitbasher:**
156
+ ```bash
157
+ gitb merge to-main # Switch to main and merge current branch
158
+ gitb branch delete # Select and delete the merged branch
159
+ ```
160
+
161
+ ### 🤖 Scenario 4: AI-Powered Development
162
+
163
+ **After making changes to multiple files:**
164
+ ```bash
165
+ gitb commit ai # AI analyzes changes and generates:
166
+ # "feat(auth): implement JWT authentication with refresh tokens"
167
+ ```
168
+
169
+ **For quick fixes:**
170
+ ```bash
171
+ gitb commit aif # AI commit all files with smart message
172
+ ```
173
+
174
+ ### 🎯 Scenario 5: Code Review Preparation
175
+
176
+ **Clean up commits before PR:**
177
+ ```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
181
+ ```
182
+
183
+ ### 📦 Scenario 6: Release Management
184
+
185
+ **Creating and managing releases:**
186
+ ```bash
187
+ gitb tag # Create version tag
188
+ gitb tag push # Push tag to remote
189
+ gitb log # Review commit history
190
+ ```
191
+
192
+
193
+ ## AI-Powered Commits
194
+
195
+ Transform your commit workflow with AI-generated messages that follow conventional commit standards.
196
+
197
+ ### Setup (One-time)
198
+
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
203
+
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)
209
+ ```
210
+
211
+ #### 3. Optional: Proxy Setup
212
+ For regions with API restrictions:
213
+ ```bash
214
+ gitb cfg proxy
215
+ # Examples:
216
+ # http://proxy.example.com:8080
217
+ # http://username:password@proxy.example.com:8080
218
+ ```
219
+
220
+ ### AI Command Examples
221
+
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 |
230
+
231
+ ## Common Workflows
232
+
233
+ ### 🔄 Daily Development Workflow
234
+
235
+ ```bash
236
+ # Start your day
237
+ gitb st # Check repository status
238
+ gitb pu # Pull latest changes
239
+
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
245
+
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
+ ```
251
+
252
+ ### 🚨 Hotfix Workflow
253
+
254
+ ```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
262
+ ```
263
+
264
+ ### 🔀 Feature Integration
265
+
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
273
+
274
+ # Integrate
275
+ gitb m to-main # Merge to main
276
+ gitb b del # Clean up feature branch
277
+ ```
278
+
279
+ ### 🎯 Release Workflow
280
+
281
+ ```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
287
+ ```
288
+
289
+ ### 🛠️ Maintenance Workflow
290
+
291
+ ```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
533
+
534
+ # Test with a simple commit
535
+ echo "test" >> test.txt
536
+ git add test.txt
537
+ gitb c ai
538
+
539
+ # If in restricted region, set up proxy
540
+ gitb cfg proxy
541
+ # Example: http://proxy.example.com:8080
542
+ ```
543
+
544
+ #### ❓ "Bad substitution" or bash errors
545
+ ```bash
546
+ # Check bash version (needs 4.0+)
547
+ bash --version
548
+
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
556
+
557
+ # Ubuntu/Debian: upgrade bash
558
+ sudo apt update && sudo apt install --only-upgrade bash
559
+ ```
560
+
561
+ #### ❓ Git operations fail
562
+ ```bash
563
+ # Check git version (needs 2.23+)
564
+ git --version
565
+
566
+ # Update git
567
+ # macOS: brew install git
568
+ # Ubuntu: sudo apt install git
569
+ # Or download from: https://git-scm.com/downloads
570
+ ```
571
+
572
+ ### 🔧 System Requirements
573
+
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 |
579
+
580
+ ### 💡 Pro Tips
581
+
582
+ #### 🎯 **Workflow Optimization**
583
+ ```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
589
+ ```
590
+
591
+ ### 🆘 **Still Having Issues?**
592
+
593
+ **Ask for help**: [Open an issue](https://github.com/maxbolgarin/gitbasher/issues) or contact [@maxbolgarin](https://t.me/maxbolgarin)
594
+
595
+ ### 🗑️ **Uninstall**
596
+
597
+ ```bash
598
+ # Remove gitbasher
599
+ sudo rm /usr/local/bin/gitb
600
+ # or
601
+ rm ~/.local/bin/gitb
602
+
603
+ # Remove configuration (optional)
604
+ rm -rf ~/.gitbasher
605
+ ```
606
+
607
+
608
+ ## Roadmap for v4
609
+
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
614
+
615
+ ## Testing
616
+
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.
618
+
619
+ ### Running Tests
620
+
621
+ ```bash
622
+ # Run all tests
623
+ make test
624
+
625
+ # Run a specific test file
626
+ make test-file FILE=test_sanitization.bats
627
+
628
+ # Or use the test runner directly
629
+ cd tests
630
+ ./run_tests.sh
631
+ ```
632
+
633
+ ### Test Coverage
634
+
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
640
+
641
+ See [tests/README.md](tests/README.md) for detailed testing documentation.
642
+
643
+ ## Contributing
644
+
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
646
+
647
+ ### Development Workflow
648
+
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
656
+
657
+ #### Maintainers
658
+
659
+ * [maxbolgarin](https://github.com/maxbolgarin)
660
+
661
+ #### License
662
+
663
+ The source code license is MIT, as described in the [LICENSE](./LICENSE) file.
package/bin/gitb ADDED
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+ # Placeholder file - will be replaced during npm install by download-release.js
3
+ # This file exists only to satisfy npm publish validation
4
+ echo "Error: gitbasher binary not found. Please reinstall: npm install -g gitbasher" >&2
5
+ exit 1
@@ -0,0 +1,48 @@
1
+ const https = require('https');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ const VERSION = process.env.npm_package_version;
6
+ if (!VERSION) {
7
+ console.error('Error: npm_package_version not found');
8
+ process.exit(1);
9
+ }
10
+
11
+ // __dirname points to the package root when installed via npm
12
+ const BIN_DIR = path.join(__dirname, 'bin');
13
+ const BIN_PATH = path.join(BIN_DIR, 'gitb');
14
+ const RELEASE_URL = `https://github.com/maxbolgarin/gitbasher/releases/download/v${VERSION}/gitb`;
15
+
16
+ // Ensure bin directory exists
17
+ if (!fs.existsSync(BIN_DIR)) {
18
+ fs.mkdirSync(BIN_DIR, { recursive: true });
19
+ }
20
+
21
+ // Download the release asset
22
+ console.log(`Downloading gitbasher v${VERSION} from GitHub releases...`);
23
+ const file = fs.createWriteStream(BIN_PATH);
24
+
25
+ https.get(RELEASE_URL, (response) => {
26
+ if (response.statusCode === 302 || response.statusCode === 301) {
27
+ // Follow redirect
28
+ https.get(response.headers.location, (redirectResponse) => {
29
+ redirectResponse.pipe(file);
30
+ file.on('finish', () => {
31
+ file.close();
32
+ fs.chmodSync(BIN_PATH, 0o755);
33
+ console.log('Download complete!');
34
+ });
35
+ });
36
+ } else {
37
+ response.pipe(file);
38
+ file.on('finish', () => {
39
+ file.close();
40
+ fs.chmodSync(BIN_PATH, 0o755);
41
+ console.log('Download complete!');
42
+ });
43
+ }
44
+ }).on('error', (err) => {
45
+ fs.unlinkSync(BIN_PATH);
46
+ console.error(`Error downloading release: ${err.message}`);
47
+ process.exit(1);
48
+ });
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "gitbasher",
3
+ "version": "3.8.0",
4
+ "description": "Simple bash utility that makes git easy to use",
5
+ "keywords": [
6
+ "git",
7
+ "bash",
8
+ "cli",
9
+ "version-control"
10
+ ],
11
+ "author": "maxbolgarin",
12
+ "license": "MIT",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "https://github.com/maxbolgarin/gitbasher.git"
16
+ },
17
+ "homepage": "https://github.com/maxbolgarin/gitbasher#readme",
18
+ "bin": {
19
+ "gitb": "bin/gitb"
20
+ },
21
+ "files": [
22
+ "bin",
23
+ "download-release.js",
24
+ "README.md",
25
+ "LICENSE"
26
+ ],
27
+ "scripts": {
28
+ "postinstall": "node download-release.js"
29
+ },
30
+ "engines": {
31
+ "node": ">=14.0.0"
32
+ }
33
+ }