Skip to main content

fold

fold | squash

combine multiple commits into a single commit

With --from, fold all of the commit linearly between the current commit and the specified commit.

With --exact, fold only the specified commits while ignoring the current commit. The given commits must form a linear, continuous chain.

Some examples:

  • Fold from the current commit to its parent:
sl fold --from .^
  • Fold all draft commits into the current commit:
sl fold --from 'draft()'

See sl help phases for more about draft commits and sl help revsets for more about the draft() keyword.

sl fold --from e254371c1::be57079e4

sl fold "e254371c1 + be57079" --exact

  • Only fold commits linearly between foo and .:
sl fold foo::. --exact

arguments

shortnamefullnamedefaultdescription
-r--revrevision to fold
--exactonly fold specified revisions
--fromfold linearly from current revision to specified revision
--no-rebasefalsedon't rebase descendants after fold
-M--reuse-messagereuse commit message from REV
-m--messageuse text as commit message
-l--logfileread commit message from file
-d--daterecord the specified date as commit date
-u--userrecord the specified user as committer