Skip to content
claytonrcarter edited this page Sep 7, 2025 · 1 revision

Description

Available on main, will be released in v0.11.

git split is used to extract changes from commits, automatically rebasing as needed.

Usage

git split has several different modes of action, depending on the flags given on the command line:

  • default (no flags) is "insert after": extracted changes are inserted into commit graph as a child of the target commit
    • any children of the target commit are rebased onto the extracted commit
    • eg A - B - CA - B' - b - C
  • --detach: similar to above, but
    • children of the target commit are rebased onto the newly split target commit, not onto the extracted commit
    • eg A - B - CA - B' - C and B' - b
    • that is: b and C are now both children of B'
  • --discard: similar to --detach, but after extracting the changes, they are simply discarded
    • eg A - B - CA - B' - C
  • --before: the extracted changes are inserted as a parent of the newly split target commit
    • children of the target commit are rebased onto the newly split target commit
    • eg A - B - CA - b - B' - C
  • with --detach and --discard, rebase conflicts are possible, and are intended to be resolved in the same way are for git move conflicts
Clone this wiki locally