cherrypick-interactive 1.5.0 β†’ 1.6.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.
Files changed (3) hide show
  1. package/README.md +190 -19
  2. package/cli.js +856 -802
  3. package/package.json +11 -7
package/README.md CHANGED
@@ -7,13 +7,15 @@
7
7
  ## 🚧 Motivation
8
8
 
9
9
  When you maintain long-lived branches like `dev` and `main`, keeping them in sync can get messy.
10
- Sometimes you rebase, sometimes you cherry-pick, sometimes you merge release branches β€” and every time, it’s easy to lose track of which commits actually made it into production.
10
+ Sometimes you rebase, sometimes you cherry-pick, sometimes you merge release branches β€” and every time, it's easy to lose track of which commits actually made it into production.
11
11
 
12
12
  **This CLI solves that pain point:**
13
13
 
14
14
  - It compares two branches (e.g. `origin/dev` vs `origin/main`)
15
15
  - Lists commits in `dev` that are *not yet* in `main`
16
16
  - Lets you choose which ones to cherry-pick interactively
17
+ - Handles merge conflicts with an interactive resolution wizard
18
+ - Preserves original commit messages perfectly (even with squashed commits)
17
19
  - (Optionally) bumps your semantic version, creates a release branch, updates `package.json`, and opens a GitHub draft PR for review
18
20
 
19
21
  No manual `git log` diffing. No risky merges. No guesswork.
@@ -25,6 +27,8 @@ No manual `git log` diffing. No risky merges. No guesswork.
25
27
  - πŸ” Finds commits in `dev` not present in `main`
26
28
  - πŸ—‚οΈ Lets you select which commits to cherry-pick (or pick all)
27
29
  - πŸͺœ Cherry-picks in the correct order (oldest β†’ newest)
30
+ - βš”οΈ **Interactive conflict resolution wizard** with multiple strategies
31
+ - 🎯 **Preserves exact commit messages** from squashed commits
28
32
  - πŸͺ„ Detects **semantic version bump** (`major`, `minor`, `patch`) from conventional commits
29
33
  - 🧩 Creates a `release/x.y.z` branch from `main`
30
34
  - 🧾 Generates a Markdown changelog from commits
@@ -48,7 +52,12 @@ npm install -g cherrypick-interactive
48
52
  ## πŸš€ Quick Start
49
53
 
50
54
  ```bash
51
- cherrypick-interactive --semantic-versioning --version-file ./package.json --create-release --push-release --draft-pr
55
+ cherrypick-interactive \
56
+ --semantic-versioning \
57
+ --version-file ./package.json \
58
+ --create-release \
59
+ --push-release \
60
+ --draft-pr
52
61
  ```
53
62
 
54
63
  βœ… This will:
@@ -57,7 +66,7 @@ cherrypick-interactive --semantic-versioning --version-file ./package.json
57
66
  3. Let you select which to cherry-pick
58
67
  4. Compute the next version from commit messages
59
68
  5. Create `release/<next-version>` from `main`
60
- 6. Cherry-pick the selected commits
69
+ 6. Cherry-pick the selected commits (with conflict resolution if needed)
61
70
  7. Update your `package.json` version and commit it
62
71
  8. Push the branch and open a **draft PR** on GitHub
63
72
 
@@ -71,7 +80,7 @@ cherrypick-interactive --semantic-versioning --version-file ./package.json
71
80
  cherrypick-interactive
72
81
  ```
73
82
 
74
- Lists commits in `origin/dev` that aren’t in `origin/main`, filtered by the last week.
83
+ Lists commits in `origin/dev` that aren't in `origin/main`, filtered by the last week.
75
84
 
76
85
  ### 2. Cherry-pick all missing commits automatically
77
86
 
@@ -85,6 +94,22 @@ cherrypick-interactive --all-yes
85
94
  cherrypick-interactive --dry-run
86
95
  ```
87
96
 
97
+ ### 4. Filter commits by pattern
98
+
99
+ ```bash
100
+ cherrypick-interactive --ignore-commits "^chore\(deps\)|^ci:"
101
+ ```
102
+
103
+ Excludes commits starting with `chore(deps)` or `ci:` from the selection list.
104
+
105
+ ### 5. Ignore certain commits from semantic versioning
106
+
107
+ ```bash
108
+ cherrypick-interactive --ignore-semver "bump|dependencies"
109
+ ```
110
+
111
+ Treats commits containing "bump" or "dependencies" as chores (no version bump).
112
+
88
113
  ---
89
114
 
90
115
  ## βš™οΈ Options
@@ -97,13 +122,15 @@ cherrypick-interactive --dry-run
97
122
  | `--no-fetch` | Skip `git fetch --prune` | `false` |
98
123
  | `--all-yes` | Cherry-pick all missing commits without prompt | `false` |
99
124
  | `--dry-run` | Show what would happen without applying changes | `false` |
100
- | `--semantic-versioning` | Detect semantic version bump from commits | `false` |
125
+ | `--semantic-versioning` | Detect semantic version bump from commits | `true` |
101
126
  | `--current-version` | Current version (if not reading from file) | β€” |
102
- | `--version-file` | Path to `package.json` (to read & update version) | β€” |
103
- | `--create-release` | Create `release/x.y.z` branch from `main` | `false` |
127
+ | `--version-file` | Path to `package.json` (to read & update version) | `./package.json` |
128
+ | `--create-release` | Create `release/x.y.z` branch from `main` | `true` |
104
129
  | `--push-release` | Push release branch to origin | `true` |
105
130
  | `--draft-pr` | Create the GitHub PR as a draft | `false` |
106
131
  | `--version-commit-message` | Template for version bump commit | `chore(release): bump version to {{version}}` |
132
+ | `--ignore-semver` | Comma-separated regex patterns to ignore for semver | β€” |
133
+ | `--ignore-commits` | Comma-separated regex patterns to exclude commits | β€” |
107
134
 
108
135
  ---
109
136
 
@@ -117,6 +144,39 @@ The tool analyzes commit messages using **Conventional Commits**:
117
144
  | `feat:` | `feat(ui): add dark mode` | **minor** |
118
145
  | `fix:` / `perf:` | `fix(api): correct pagination offset` | **patch** |
119
146
 
147
+ Use `--ignore-semver` to treat certain commits as chores:
148
+
149
+ ```bash
150
+ cherrypick-interactive --ignore-semver "^chore\(deps\)|bump|merge"
151
+ ```
152
+
153
+ ---
154
+
155
+ ## βš”οΈ Interactive Conflict Resolution
156
+
157
+ When cherry-picking encounters conflicts, the tool provides an **interactive wizard**:
158
+
159
+ ### Conflict Resolution Options:
160
+
161
+ **Per-file resolution:**
162
+ - **Use ours** β€” Keep the current branch's version
163
+ - **Use theirs** β€” Accept the cherry-picked commit's version
164
+ - **Open in editor** β€” Manually resolve conflicts in your editor
165
+ - **Show diff** β€” View the conflicting changes
166
+ - **Mark resolved** β€” Stage the file as-is
167
+
168
+ **Bulk actions:**
169
+ - **Use ours for ALL** β€” Apply current branch's version to all conflicts
170
+ - **Use theirs for ALL** β€” Accept cherry-picked version for all conflicts
171
+ - **Stage ALL** β€” Mark all files as resolved
172
+ - **Launch mergetool** β€” Use Git's configured merge tool
173
+
174
+ ### Key Features:
175
+
176
+ βœ… **Preserves original commit messages** β€” Even when resolving conflicts, the commit message from the original commit in `dev` is maintained exactly
177
+ βœ… **Handles squashed commits** β€” Works correctly with squashed commits that contain multiple changes
178
+ βœ… **Resume cherry-picking** β€” After resolving conflicts, automatically continues with remaining commits
179
+
120
180
  ---
121
181
 
122
182
  ## πŸͺ΅ Example Run
@@ -129,18 +189,47 @@ Comparing subjects since 1 week ago
129
189
  Dev: origin/dev
130
190
  Main: origin/main
131
191
 
132
- Select commits to cherry-pick (3 missing):
133
- ❯◯ (850aa02) fix: crypto withdrawal payload
134
- β—― (2995cea) feat: OTC offer account validation
135
- β—― (84fe310) chore: bump dependencies
192
+ βœ” Select commits to cherry-pick (8 missing):
193
+ βœ” #86c6105k9 - Add missing ATS configs in plists. (#1077)
194
+ βœ” chore(deps): bump actions/checkout from 3 to 6 (#1079)
195
+ βœ” #86c6q8y5r - Separete Corporate and Individual Registration (#1081)
196
+ βœ” #86c5wbbuc - Refactor splash related store initializations (#1082)
197
+ βœ” #86c6x2u20 - Remove deprecated reward center components (#1085)
198
+ βœ” #0 - Upgrade ruby version in workflows. (#1087)
199
+
200
+ β†· Semver ignored (pattern: /bump/i): (chore(deps): bump actions/checkout from 3 to 6 (#1079))
201
+ β†· Semver ignored (pattern: /bump/i): (#86c5wbbuc - Refactor splash related store initializations (#1082))
136
202
 
137
203
  Semantic Versioning
138
- Current: 1.20.0 Detected bump: minor Next: 1.21.0
204
+ Current: 4.36.0 Detected bump: minor Next: 4.37.0
205
+
206
+ Creating release/4.37.0 from origin/main...
207
+ βœ“ Ready on release/4.37.0. Cherry-picking will apply here.
208
+
209
+ Cherry-picking 6 commit(s) onto main (oldest β†’ newest)...
210
+
211
+ βœ“ cherry-picked (7ba30af) #86c6105k9 - Add missing ATS configs in plists. (#1077)
212
+ βœ“ cherry-picked (bbc70ed) chore(deps): bump actions/checkout from 3 to 6 (#1079)
213
+ βœ“ cherry-picked (287dbad) #86c6q8y5r - Separete Corporate and Individual Registration (#1081)
139
214
 
140
- Creating release/1.21.0 from origin/main...
141
- βœ“ Ready on release/1.21.0. Cherry-picking will apply here.
142
- βœ“ package.json updated and committed: chore(release): bump version to 1.21.0
143
- βœ… Pull request created for release/1.21.0 β†’ main
215
+ βœ– Cherry-pick has conflicts on 8eb07cb78148866d769684730d154e5cbeb2f331 (8eb07cb).
216
+ Conflicted files:
217
+ - android/app/build.gradle
218
+ - ios/bilira_wallet.xcodeproj/project.pbxproj
219
+
220
+ βœ” Choose how to proceed: Resolve conflicts now
221
+ βœ” Select a file to resolve or a global action: Use theirs for ALL
222
+
223
+ No conflicted files reported by git.
224
+ βœ“ cherry-picked (8eb07cb) #86c5wbbuc - Refactor splash related store initializations (#1082)
225
+ βœ“ cherry-picked (3ae27ee) #86c6x2u20 - Remove deprecated reward center components (#1085)
226
+ βœ“ cherry-picked (66d0419) #0 - Upgrade ruby version in workflows. (#1087)
227
+
228
+ Summary β†’ applied: 6, skipped: 0
229
+
230
+ Updating package.json version β†’ 4.37.0 ...
231
+ βœ“ package.json updated and committed: chore(release): bump version to 4.37.0
232
+ βœ… Pull request created for release/4.37.0 β†’ main
144
233
  ```
145
234
 
146
235
  ---
@@ -150,21 +239,68 @@ Creating release/1.21.0 from origin/main...
150
239
  If your team:
151
240
  - Rebases or cherry-picks from `dev` β†’ `main`
152
241
  - Uses temporary release branches
242
+ - Works with squashed commits
243
+ - Needs to handle merge conflicts gracefully
153
244
  - Tracks semantic versions via commits
154
245
 
155
246
  …this CLI saves time and reduces errors.
156
247
  It automates a tedious, error-prone manual process into a single command that behaves like `yarn upgrade-interactive`, but for Git commits.
157
248
 
249
+ **Special features:**
250
+ - βœ… Preserves exact commit messages (critical for squashed commits)
251
+ - βœ… Interactive conflict resolution without leaving the terminal
252
+ - βœ… Smart pattern-based filtering for commits and version detection
253
+ - βœ… Automatic changelog generation
254
+
158
255
  ---
159
256
 
160
257
  ## 🧰 Requirements
161
258
 
162
259
  - Node.js β‰₯ 18
163
- - GitHub CLI (`gh`) installed and authenticated
260
+ - Git β‰₯ 2.0
261
+ - **GitHub CLI (`gh`)** β€” *Optional, only required if using `--push-release`*
262
+ - Install from: https://cli.github.com/
263
+ - The tool will check if `gh` is installed and offer to continue without it
164
264
  - A clean working directory (no uncommitted changes)
165
265
 
166
266
  ---
167
267
 
268
+ ## 🎯 Best Practices
269
+
270
+ ### 1. Use `--ignore-commits` to filter noise
271
+
272
+ ```bash
273
+ cherrypick-interactive --ignore-commits "^ci:|^chore\(deps\):|Merge branch"
274
+ ```
275
+
276
+ Exclude CI updates, dependency bumps, and merge commits from selection.
277
+
278
+ ### 2. Use `--ignore-semver` for version accuracy
279
+
280
+ ```bash
281
+ cherrypick-interactive --ignore-semver "bump|dependencies|merge"
282
+ ```
283
+
284
+ Prevent certain commits from affecting semantic version calculation.
285
+
286
+ ### 3. Always use `--draft-pr` for review
287
+
288
+ ```bash
289
+ cherrypick-interactive --draft-pr
290
+ ```
291
+
292
+ Creates draft PRs so your team can review before merging.
293
+
294
+ ### 4. Test with `--dry-run` first
295
+
296
+ ```bash
297
+ cherrypick-interactive --dry-run
298
+ ```
299
+
300
+ See what would happen without making any changes.
301
+
302
+ ---
303
+
168
304
  ## 🧾 License
169
305
 
170
306
  **MIT** β€” free to use, modify, and distribute.
@@ -178,9 +314,44 @@ It automates a tedious, error-prone manual process into a single command that be
178
314
  ```bash
179
315
  node cli.js --dry-run
180
316
  ```
181
- 3. Test edge cases before submitting PRs
317
+ 3. Test edge cases before submitting PRs:
318
+ - Squashed commits with conflicts
319
+ - Empty cherry-picks
320
+ - Multiple conflict resolutions
182
321
  4. Please follow Conventional Commits for your changes.
183
322
 
184
323
  ---
185
324
 
186
- > Created to make release management simpler and safer for teams who value clean Git history and predictable deployments.
325
+ ## πŸ› Troubleshooting
326
+
327
+ ### "GitHub CLI (gh) is not installed"
328
+ The tool automatically checks for `gh` CLI when using `--push-release`. If not found, you'll be prompted to:
329
+ - Install it from https://cli.github.com/ and try again
330
+ - Or continue without creating a PR (the release branch will still be pushed)
331
+
332
+ You can also run without `--push-release` to skip PR creation entirely:
333
+ ```bash
334
+ cherrypick-interactive --create-release --no-push-release
335
+ ```
336
+
337
+ ### "Cherry-pick has conflicts"
338
+ Use the interactive wizard to resolve conflicts file-by-file or in bulk.
339
+
340
+ ### "Commit message changed after conflict resolution"
341
+ This issue has been fixed! The tool now preserves the original commit message using `git commit -C <hash>`.
342
+
343
+ ### "Version not detected correctly"
344
+ Use `--ignore-semver` to exclude commits that shouldn't affect versioning:
345
+ ```bash
346
+ cherrypick-interactive --ignore-semver "bump|chore\(deps\)"
347
+ ```
348
+
349
+ ### "Too many commits to review"
350
+ Use `--ignore-commits` to filter out noise, or adjust `--since` to a shorter time window:
351
+ ```bash
352
+ cherrypick-interactive --since "3 days ago" --ignore-commits "^ci:|^docs:"
353
+ ```
354
+
355
+ ---
356
+
357
+ > Created to make release management simpler and safer for teams who value clean Git history, predictable deployments, and efficient conflict resolution.