Skip to main content

Module rebase

Module rebase 

Source
Expand description

Git rebase operations using libgit2 with Git CLI fallback.

This module provides functionality to:

  • Perform rebase operations onto a specified upstream branch
  • Detect and report conflicts during rebase
  • Abort an in-progress rebase
  • Continue a rebase after conflict resolution
  • Get lists of conflicted files
  • Handle all rebase failure modes with fault tolerance

§Architecture

This module uses a hybrid approach:

  • libgit2: For repository state detection, validation, and queries
  • Git CLI: For the actual rebase operation (more reliable)
  • Fallback patterns: For operations that may fail with libgit2

The Git CLI is used for rebase operations because:

  1. Better error messages for classification
  2. More robust edge case handling
  3. Better tested across Git versions
  4. Supports autostash and other features reliably

Enums§

RebaseErrorKind
Detailed classification of rebase failure modes.
RebaseResult
Result of a rebase operation.

Functions§

abort_rebase
Abort the current rebase operation.
classify_rebase_error
Parse Git CLI output to classify rebase errors.
continue_rebase
Continue a rebase after conflict resolution.
get_conflict_markers_for_file
Extract conflict markers from a file.
get_conflicted_files
Get a list of files that have merge conflicts.
rebase_in_progress
Check if a rebase is currently in progress.
rebase_onto
Perform a rebase onto the specified upstream branch.