Skip to content

Commit f0aa089

Browse files
committed
docs: add --skip and robustness features to README and CHANGELOG
- Document --skip flag in command options, examples, and conflict handling sections of README - Add external abort detection and chain validation to README - Update recovery options to include --skip - Add Phase 2 entries to CHANGELOG
1 parent 39f221c commit f0aa089

2 files changed

Lines changed: 52 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1616
- Updated CLAUDE.md to reference Makefile targets instead of raw cargo commands
1717

1818
### Added
19+
- Added `--skip` flag to `rebase` command for skipping a conflicted branch and continuing the chain rebase
20+
- Aborts any in-progress git rebase
21+
- Restores the conflicted branch to its original position using saved refs
22+
- Marks the branch as Skipped and resumes rebasing from the next pending branch
23+
- Added external `git rebase --abort` detection in `rebase --continue`
24+
- Detects when the user has aborted a git rebase directly (bypassing git-chain)
25+
- Compares branch's current OID with saved original ref to identify external aborts
26+
- Provides clear error message suggesting `--skip` or `--abort`
27+
- Added chain modification validation in `rebase --continue` and `rebase --skip`
28+
- Validates that pending branches still exist before attempting to rebase them
29+
- Warns and automatically skips branches that were deleted externally during a chain rebase
30+
- Added atomic state file writes using write-to-temp-then-rename pattern
31+
- Prevents state file corruption if the process is killed mid-write
32+
- Added integration tests for rebase --skip:
33+
- `rebase_skip_conflicted_branch`, `rebase_skip_no_state`, `rebase_skip_then_verify_chain_status`
34+
- Added integration tests for robustness features:
35+
- `rebase_continue_after_external_abort`, `rebase_continue_with_deleted_branch`
1936
- Added `--continue` flag to `rebase` command for resuming a chain rebase after resolving conflicts
2037
- Loads saved state from `.git/chain-rebase-state.json`
2138
- Marks the conflicted branch as completed and resumes from the next pending branch

README.md

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,12 @@ Git Chain's rebase command offers customization through its flags:
106106
```
107107
After resolving a rebase conflict and completing the git-level rebase (`git rebase --continue`), use this to continue rebasing the remaining branches in the chain. Uses saved merge bases from the original run.
108108

109+
- **`--skip`**: Skip the current conflicted branch and continue with the rest of the chain
110+
```
111+
git chain rebase --skip
112+
```
113+
When a rebase conflict occurs and you don't want to resolve it, use `--skip` to restore the conflicted branch to its original position and continue rebasing the remaining branches. This aborts any in-progress git rebase automatically.
114+
109115
- **`--abort`**: Abort a chain rebase and restore all branches
110116
```
111117
git chain rebase --abort
@@ -171,6 +177,11 @@ git rebase --continue
171177
git chain rebase --continue
172178
```
173179

180+
Or if you want to skip the conflicted branch and continue with the rest:
181+
```
182+
git chain rebase --skip
183+
```
184+
174185
Or if you want to abort the entire chain rebase and restore all branches:
175186
```
176187
git chain rebase --abort
@@ -194,7 +205,7 @@ When rebasing branches in a chain, conflicts can sometimes occur. Git Chain save
194205
- Pauses the rebasing process at the conflicted commit
195206
- Saves the chain rebase state (original branch refs, merge bases, per-branch status)
196207
- Leaves the repository in a conflicted state for you to resolve
197-
- Provides numbered recovery steps with `--continue` and `--abort` instructions
208+
- Provides numbered recovery steps with `--continue`, `--skip`, and `--abort` instructions
198209

199210
2. **Resolution Process**:
200211
- The conflicted files will be marked with conflict markers (`<<<<<<<`, `=======`, `>>>>>>>`)
@@ -210,13 +221,25 @@ When rebasing branches in a chain, conflicts can sometimes occur. Git Chain save
210221
- Git Chain loads the saved state and continues rebasing the remaining branches using pre-computed merge bases
211222
- After all branches are rebased, the state file is cleaned up and you are returned to your original branch
212223

213-
4. **Aborting a Problematic Rebase**:
214-
- If you decide not to resolve the conflicts, abort the entire chain rebase:
224+
4. **Skipping a Problematic Branch**:
225+
- If you don't want to resolve the conflict for a particular branch, skip it and continue:
226+
```
227+
git chain rebase --skip
228+
```
229+
- This aborts the in-progress git rebase, restores the conflicted branch to its original position, and continues rebasing the remaining branches
230+
231+
5. **Aborting the Entire Chain Rebase**:
232+
- If you decide to cancel the entire chain rebase and restore all branches:
215233
```
216234
git chain rebase --abort
217235
```
218236
- This restores all branches to their original positions, aborts any in-progress git rebase, and cleans up the state file
219237

238+
6. **External Abort Detection**:
239+
- If you run `git rebase --abort` directly (bypassing git-chain), git-chain detects this when you run `--continue`
240+
- It compares the branch's current commit with the saved original ref to determine if the rebase was aborted externally
241+
- You'll be prompted to use `--skip` to skip the branch or `--abort` to cancel the entire chain rebase
242+
220243
**Example Conflict Workflow**:
221244
```
222245
$ git chain rebase
@@ -241,25 +264,30 @@ Rebasing branch feature/profiles onto feature/auth...
241264

242265
If a rebase goes wrong, Git Chain provides several recovery options:
243266

244-
1. **Abort Chain Rebase**: If a chain rebase is in progress (state file exists), abort and restore all branches:
267+
1. **Skip Conflicted Branch**: Skip the branch that has conflicts and continue with the rest of the chain:
268+
```
269+
git chain rebase --skip
270+
```
271+
272+
2. **Abort Chain Rebase**: If a chain rebase is in progress (state file exists), abort and restore all branches:
245273
```
246274
git chain rebase --abort
247275
```
248276

249-
2. **Backup Branches**: Backup branches are automatically created when squash-merged branches are reset (via `--squashed-merge=reset`). You can also create backups manually with `git chain backup`. To restore:
277+
3. **Backup Branches**: Backup branches are automatically created when squash-merged branches are reset (via `--squashed-merge=reset`). You can also create backups manually with `git chain backup`. To restore:
250278
```
251279
git checkout branch-name
252280
git reset --hard backup-chain-name/branch-name
253281
```
254282

255-
3. **Reflog**: Even without backups, you can recover using Git's reflog:
283+
4. **Reflog**: Even without backups, you can recover using Git's reflog:
256284
```
257285
git checkout branch-name
258286
git reflog
259287
git reset --hard branch-name@{1} # Reset to previous state
260288
```
261289

262-
4. **Abort Git-Level Rebase**: If only the git-level rebase needs aborting (before using `--abort`):
290+
5. **Abort Git-Level Rebase**: If only the git-level rebase needs aborting (before using `--abort`):
263291
```
264292
git rebase --abort
265293
```

0 commit comments

Comments
 (0)