-
-
Notifications
You must be signed in to change notification settings - Fork 97
Command: git split
claytonrcarter edited this page Sep 7, 2025
·
1 revision
Available on main
, will be released in v0.11.
git split
is used to extract changes from commits, automatically rebasing as needed.
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 - C
→A - 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 - C
→A - B' - C
andB' - b
- that is:
b
andC
are now both children ofB'
-
--discard
: similar to--detach
, but after extracting the changes, they are simply discarded- eg
A - B - C
→A - B' - C
- eg
-
--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 - C
→A - b - B' - C
- with
--detach
and--discard
, rebase conflicts are possible, and are intended to be resolved in the same way are forgit move
conflicts
- Search the Wiki 🔎
- User guide
- Welcome
- Installation
- Tutorial
- Command overview
- General:
- Navigation:
- Committing:
- Rebasing:
- Verification:
- Collaboration:
- Workflows
- Advanced topics
- Reference
- Developer guide
- Onboarding offer
- Development
- Reference