Skip to content

Commit 56d4d6b

Browse files
authored
Merge pull request #2 from dagjomar/docs/add-use-case-section
docs: add practical use case section to README
2 parents 5127d15 + 188c710 commit 56d4d6b

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

‎README.md‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,48 @@
1111

1212
Git Stack is a simple, no-frills command-line utility that makes managing stacked Git branches quick and painless. Whether you're creating, incrementing, or cleaning up branches, Git Stack helps you stay organized with minimal effort, so you can focus on what matters—writing code.
1313

14+
## When Git Stack Helps
15+
16+
**Scenario**: Bob wants to refactor `example-file.ts`. His plan: (1) add unit tests for existing functionality, (2) refactor the inner workings, (3) add a new function with updated tests.
17+
18+
**With Git Stack**:
19+
```bash
20+
# When on main branch, make a new stack with a name:
21+
$main > git stack create bob
22+
> created branch "bob-0"
23+
$bob-0 > git commit "add unit-test"
24+
$bob-0 > git stack increment
25+
> created branch "bob-1"
26+
$bob-1 > git commit "refactor file"
27+
$bob-1 > git stack increment
28+
> created branch "bob-2"
29+
$bob-2 > git commit "add functionality"
30+
```
31+
32+
**Now the branch structure looks like:**
33+
```
34+
bob-2 (add functionality)
35+
|
36+
bob-1 (refactor file)
37+
|
38+
bob-0 (add unit-test)
39+
|
40+
main
41+
```
42+
43+
**When Alice requests changes on the first PR:**
44+
```bash
45+
$bob-2 > git checkout bob-0
46+
$bob-0 > # make Alice's requested changes
47+
$bob-0 > git commit --amend
48+
$bob-0 > git stack fix
49+
> rebasing bob-1 onto bob-0...
50+
> rebasing bob-2 onto bob-1...
51+
> stack updated successfully
52+
```
53+
54+
**Result**: Bob spends time coding, not wrestling with git. One command handles the cascade of updates across his entire dependent branch stack, keeping everything in sync while his PRs are under review.
55+
1456
## Features
1557

1658
- **Create Stacked Branches:** Easily initialize a new branch stack with a base name.

0 commit comments

Comments
 (0)