Module branchless::commands::restack[][src]

Handle “restacking” commits which were abandoned due to rewrites.

The branchless workflow promotes checking out to arbitrary commits and operating on them directly. However, if you e.g. amend a commit in-place, its descendants will be abandoned.

For example, suppose we have this graph:

:
O abc000 master
|
@ abc001 Commit 1
|
o abc002 Commit 2
|
o abc003 Commit 3

And then we amend the current commit (“Commit 1”). The descendant commits “Commit 2” and “Commit 3” will be abandoned:

:
O abc000 master
|\\
| x abc001 Commit 1
| |
| o abc002 Commit 2
| |
| o abc003 Commit 3
|
o def001 Commit 1 amended

The “restack” operation finds abandoned commits and rebases them to where they should belong, resulting in a commit graph like this (note that the hidden commits would not ordinarily be displayed; we show them only for the sake of example here):

:
O abc000 master
|\\
| x abc001 Commit 1
| |
| x abc002 Commit 2
| |
| x abc003 Commit 3
|
o def001 Commit 1 amended
|
o def002 Commit 2
|
o def003 Commit 3

Functions

find_abandoned_children

Find commits which have been “abandoned” in the commit graph.

restack

Restack all abandoned commits.