cherrypick-interactive 1.5.0 β†’ 1.6.1

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 +144 -28
  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,31 +144,38 @@ 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
+
120
153
  ---
121
154
 
122
- ## πŸͺ΅ Example Run
155
+ ## βš”οΈ Interactive Conflict Resolution
123
156
 
124
- ```bash
125
- $ cherrypick-interactive --semantic-versioning --version-file ./package.json --create-release --draft-pr
157
+ When cherry-picking encounters conflicts, the tool provides an **interactive wizard**:
126
158
 
127
- Fetching remotes (git fetch --prune)...
128
- Comparing subjects since 1 week ago
129
- Dev: origin/dev
130
- Main: origin/main
159
+ ### Conflict Resolution Options:
131
160
 
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
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
136
167
 
137
- Semantic Versioning
138
- Current: 1.20.0 Detected bump: minor Next: 1.21.0
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
139
173
 
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
144
- ```
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
145
179
 
146
180
  ---
147
181
 
@@ -150,21 +184,68 @@ Creating release/1.21.0 from origin/main...
150
184
  If your team:
151
185
  - Rebases or cherry-picks from `dev` β†’ `main`
152
186
  - Uses temporary release branches
187
+ - Works with squashed commits
188
+ - Needs to handle merge conflicts gracefully
153
189
  - Tracks semantic versions via commits
154
190
 
155
191
  …this CLI saves time and reduces errors.
156
192
  It automates a tedious, error-prone manual process into a single command that behaves like `yarn upgrade-interactive`, but for Git commits.
157
193
 
194
+ **Special features:**
195
+ - βœ… Preserves exact commit messages (critical for squashed commits)
196
+ - βœ… Interactive conflict resolution without leaving the terminal
197
+ - βœ… Smart pattern-based filtering for commits and version detection
198
+ - βœ… Automatic changelog generation
199
+
158
200
  ---
159
201
 
160
202
  ## 🧰 Requirements
161
203
 
162
204
  - Node.js β‰₯ 18
163
- - GitHub CLI (`gh`) installed and authenticated
205
+ - Git β‰₯ 2.0
206
+ - **GitHub CLI (`gh`)** β€” *Optional, only required if using `--push-release`*
207
+ - Install from: https://cli.github.com/
208
+ - The tool will check if `gh` is installed and offer to continue without it
164
209
  - A clean working directory (no uncommitted changes)
165
210
 
166
211
  ---
167
212
 
213
+ ## 🎯 Best Practices
214
+
215
+ ### 1. Use `--ignore-commits` to filter noise
216
+
217
+ ```bash
218
+ cherrypick-interactive --ignore-commits "^ci:|^chore\(deps\):|Merge branch"
219
+ ```
220
+
221
+ Exclude CI updates, dependency bumps, and merge commits from selection.
222
+
223
+ ### 2. Use `--ignore-semver` for version accuracy
224
+
225
+ ```bash
226
+ cherrypick-interactive --ignore-semver "bump|dependencies|merge"
227
+ ```
228
+
229
+ Prevent certain commits from affecting semantic version calculation.
230
+
231
+ ### 3. Always use `--draft-pr` for review
232
+
233
+ ```bash
234
+ cherrypick-interactive --draft-pr
235
+ ```
236
+
237
+ Creates draft PRs so your team can review before merging.
238
+
239
+ ### 4. Test with `--dry-run` first
240
+
241
+ ```bash
242
+ cherrypick-interactive --dry-run
243
+ ```
244
+
245
+ See what would happen without making any changes.
246
+
247
+ ---
248
+
168
249
  ## 🧾 License
169
250
 
170
251
  **MIT** β€” free to use, modify, and distribute.
@@ -178,9 +259,44 @@ It automates a tedious, error-prone manual process into a single command that be
178
259
  ```bash
179
260
  node cli.js --dry-run
180
261
  ```
181
- 3. Test edge cases before submitting PRs
262
+ 3. Test edge cases before submitting PRs:
263
+ - Squashed commits with conflicts
264
+ - Empty cherry-picks
265
+ - Multiple conflict resolutions
182
266
  4. Please follow Conventional Commits for your changes.
183
267
 
184
268
  ---
185
269
 
186
- > Created to make release management simpler and safer for teams who value clean Git history and predictable deployments.
270
+ ## πŸ› Troubleshooting
271
+
272
+ ### "GitHub CLI (gh) is not installed"
273
+ The tool automatically checks for `gh` CLI when using `--push-release`. If not found, you'll be prompted to:
274
+ - Install it from https://cli.github.com/ and try again
275
+ - Or continue without creating a PR (the release branch will still be pushed)
276
+
277
+ You can also run without `--push-release` to skip PR creation entirely:
278
+ ```bash
279
+ cherrypick-interactive --create-release --no-push-release
280
+ ```
281
+
282
+ ### "Cherry-pick has conflicts"
283
+ Use the interactive wizard to resolve conflicts file-by-file or in bulk.
284
+
285
+ ### "Commit message changed after conflict resolution"
286
+ This issue has been fixed! The tool now preserves the original commit message using `git commit -C <hash>`.
287
+
288
+ ### "Version not detected correctly"
289
+ Use `--ignore-semver` to exclude commits that shouldn't affect versioning:
290
+ ```bash
291
+ cherrypick-interactive --ignore-semver "bump|chore\(deps\)"
292
+ ```
293
+
294
+ ### "Too many commits to review"
295
+ Use `--ignore-commits` to filter out noise, or adjust `--since` to a shorter time window:
296
+ ```bash
297
+ cherrypick-interactive --since "3 days ago" --ignore-commits "^ci:|^docs:"
298
+ ```
299
+
300
+ ---
301
+
302
+ > Created to make release management simpler and safer for teams who value clean Git history, predictable deployments, and efficient conflict resolution.