Skip to content

Comprehensive Interactive Rebase Editor overhaul with advanced features #4813

@eamodio

Description

@eamodio

Summary

Delivers a complete overhaul of the Interactive Rebase Editor with modern Lit-based architecture, advanced Git rebase features, optimized performance, and comprehensive user experience improvements.

Impact

Transforms the rebase editor from a basic todo file editor into a powerful, feature-rich interactive tool that:

  • Supports modern Git rebase features (update-ref, merge commands)
  • Provides instant visual feedback through optimistic UI updates
  • Enables efficient multi-select operations with keyboard and mouse shortcuts
  • Offers drag-and-drop with auto-scrolling for intuitive commit reordering
  • Detects and surfaces conflicts before execution
  • Scales to large rebase operations through virtualization
  • Improves accessibility with ARIA roles and keyboard navigation
  • Integrates seamlessly with Commit Composer for AI-powered recomposition

Key Features Delivered

Multi-Select Operations

  • Mouse selection:
    • Click → select single commit
    • Ctrl/Cmd+Click → toggle commit in/out of selection
    • Shift+Click → range selection (visual or topological)
  • Keyboard selection:
    • Arrow Up/Down → move focus/selection
    • Ctrl/Cmd+Arrow Up/Down → topological navigation
    • Alt+Arrow Up/Down → jump to merge/fork points
    • Alt+Page Up/Down → jump between refs
    • Home/End → first/last commit
    • Shift+arrows → extend selection
    • Ctrl/Cmd+A → select all entries
  • Bulk actions: Change actions for multiple commits simultaneously (pick → squash, etc.)
  • Multi-select drag-and-drop: Reorder multiple selected commits together

Drag-and-Drop Enhancements

  • Auto-scrolling when dragging near viewport edges
  • Visual feedback for drop zones
  • Multi-select support (drag entire selection)
  • Topological awareness to prevent invalid reordering

Advanced Git Command Support

  • update-ref: Support for updating branch references during rebase
  • merge: Support for --rebase-merges command
  • Proper handling of onto targets and base commits
  • Validation of command sequences

Performance Optimizations

  • Virtualization: Efficiently handles large rebase lists (100+ commits)
  • Lazy loading: Batch enrichment of commit metadata and avatars on-demand
  • Optimistic UI: Instant visual feedback without waiting for backend confirmation

Conflict Detection

  • Pre-execution conflict analysis
  • Visual indicators for conflicting commits
  • Updated action buttons when conflicts detected
  • Reflection of conflict state from paused rebases

User Experience Improvements

  • Optimistic updates: Actions reflect immediately in UI
  • Keyboard shortcuts: Full keyboard navigation support
  • Accessibility: ARIA roles, labels, and focus management
  • Visual polish: Modern Lit-based components with responsive design
  • Auto-open on pause: gitlens.rebaseEditor.openOnPausedRebase setting
  • Smart window placement: Opens beside existing tabs when available

Integration with Commit Composer

  • "Recompose Commits" action to abort rebase and manage commits in Commit Composer with AI
  • Seamless handoff of commit SHAs and branch context
  • Confirmation dialog for abort-and-recompose workflow

Testing & Quality

  • Comprehensive E2E test suite (627 lines in rebase.test.ts)
  • Test coverage for: abort, action changes, multi-select, drag-and-drop, execute rebase, rebase-merges
  • GitFixture helper for consistent test setup
  • Standardized setup/teardown procedures

Validation

Multi-Select

  1. Open rebase editor with 10+ commits
  2. Verify mouse selection (Click, Ctrl+Click, Shift+Click)
  3. Verify keyboard selection (Arrow keys, Shift+Arrow, Ctrl+Arrow, Home/End)
  4. Verify Ctrl+A selects all entries
  5. Select 3 commits → change action to "squash" → verify all 3 update
  6. Select 5 commits via Shift+Click → drag to new position → verify all move together

Drag-and-Drop

  1. Drag commit to top/bottom edge → verify auto-scrolling
  2. Drag commit over invalid drop zone → verify visual feedback prevents drop
  3. Multi-select 4 commits → drag → verify all move as a unit

Advanced Git Commands

  1. Rebase with --rebase-merges → verify merge commands appear
  2. Rebase with --update-refs → verify update-ref commands appear
  3. Verify onto targets display correctly
  4. Execute rebase with merge/update-ref commands → verify Git applies correctly

Conflict Detection

  1. Start rebase known to have conflicts
  2. Verify conflict indicators appear in UI
  3. Verify "Continue" button changes to reflect conflict state
  4. Pause rebase with conflicts → reopen editor → verify conflict state persists

Performance

  1. Open rebase editor with 100+ commits
  2. Verify smooth scrolling and responsive interactions
  3. Verify commit metadata loads progressively (lazy loading)
  4. Change action on commit → verify optimistic UI update (< 50ms)

Keyboard Navigation

  1. Use only keyboard to:
    • Navigate through all commits (Arrow keys, Page Up/Down, Home/End)
    • Select ranges (Shift+Arrow)
    • Change actions (Tab to action dropdown, Enter to select)
    • Execute operations (Tab to Continue, Enter)
  2. Verify focus indicators are always visible

Accessibility

  1. Use screen reader to navigate rebase editor
  2. Verify ARIA labels announce commit info, actions, and state
  3. Verify role="grid" or appropriate ARIA structure
  4. Test with keyboard-only navigation (no mouse)

Integration with Commit Composer

  1. Start rebase → Click "Recompose Commits" → Verify confirmation dialog
  2. Confirm → Verify rebase aborts and Commit Composer opens with correct commits
  3. Test both inactive and active (paused) rebase scenarios

Auto-Open on Pause

  1. Set gitlens.rebaseEditor.openOnPausedRebase to true
  2. Start rebase → introduce conflict → verify editor opens automatically when paused
  3. Set to false → verify editor doesn't auto-open

Edge Cases

  1. Empty rebase (no commits) → verify graceful handling
  2. Single commit rebase → verify works correctly
  3. Rebase only with noop → verify treated as empty
  4. Close editor while rebase active → verify state preserved
  5. Delete rebase todo file externally → verify editor closes automatically
  6. Abort from Home view → verify editor closes automatically

Technical Details

Architecture

  • Framework: Lit Elements for reactive webview UI
  • Provider: RebaseWebviewProvider manages lifecycle and IPC
  • Protocol: Typed IPC messages (commands, requests, notifications)
  • Virtualization: Handles large commit lists efficiently
  • State Management: Context providers with reactive signals

Key Files

  • src/webviews/apps/rebase/ - Webview app implementation
  • src/webviews/rebase/ - Provider and backend logic
  • src/webviews/protocol.ts - IPC protocol definitions
  • tests/e2e/specs/rebase.test.ts - E2E test suite (627 lines)

IPC Protocol

  • RecomposeCommitsCommand: Abort rebase and open Commit Composer
  • ChangeActionCommand: Change action for selected commits
  • MoveCommand: Reorder commits via drag-and-drop
  • SelectCommand: Update selection state
  • ExecuteCommand: Continue/abort rebase
  • DidChangeNotification: Backend state updates

Risk

Medium — Comprehensive rewrite of rebase editor with many moving parts:

  • Multiple new features increase complexity
  • Git command handling requires careful validation
  • Multi-select logic has many edge cases
  • Performance optimization (virtualization) adds complexity
  • Extensive E2E tests mitigate risk

Potential regressions:

  • Rebase execution with complex command sequences
  • State synchronization between UI and Git
  • Drag-and-drop in edge cases (topological constraints)
  • Conflict detection accuracy

Follow Ups

  • Add undo/redo capability for action changes
  • Implement "preview" mode showing expected commit tree
  • Add visual diff preview for squash/fixup operations
  • Explore saving rebase templates for common workflows
  • Consider adding AI-suggested action changes
  • Add telemetry to track feature usage (multi-select, drag-drop, etc.)
  • Investigate performance with extremely large rebases (500+ commits)
  • Add keyboard shortcuts reference (? key)

Related Issues: #4405, #4383, #4160, #4148, #4032, #3897, #3866, #3815, #3393, #3337, #3310, #4796, #4775

Metadata

Metadata

Assignees

Labels

area-rebase-editorIssues or features related to the Interactive Rebase Editorhas-testplanIssue that has a test planneeds-verificationRequest for verificationpending-releaseResolved but not yet released to the stable edition

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions