STG-FOLD(1)

πŸ’… stg-fold β€” like, the manual, but make it make sense

okay bestie, welcome to stg-fold(1) from the StGit Manual ✨ this one's short and sweet and honestly kind of a banger, so let's go πŸŽ€


🌸 NAME 🌸

stg-fold β€” folds a diff file into the current patch 🫢

like, it takes a diff and just… tucks it right in. no cap.


✨ SYNOPSIS ✨

stg fold [OPTIONS] [file]

that's it. that's the whole vibe check πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so the whole point: this folds a diff file into the current patch. you hand it a GNU diff file β€” or, if you don't hand it anything, it reads from standard input β€” and it applies that onto the current patch. literally that simple 😌

now, the fun part, the options that change where stuff lands πŸ‘‘

  • with --threeway, the diff gets applied onto the bottom of the current patch, and then a three-way merge happens with the current top. yes, that's a whole journey. she's doing the most.
  • with --base, the diff gets applied onto the specified base instead, and a three-way merge happens with the current top.

both of these are giving "main character energy" for merges πŸ’œ


πŸ”₯ OPTIONS πŸ”₯

  • -t, --threeway β€” performs a three-way merge with the current patch. the classic. the icon. ✨
  • -b <committish>, --base=<committish> β€” uses <committish> instead of HEAD when applying the patch. swap out the base, slay πŸ’…
  • -p <n>, --strip=<n> β€” removes <n> leading components from the diff paths. the default is 1, so if you were wondering why your paths look shorter than expected… that's why πŸ™ˆ
  • -C <n> β€” makes sure there are <n> lines of matching context for each change. context queen πŸ‘‘
  • --reject β€” leaves the rejected hunks sitting in ".rej" files. ngl, not the prettiest outcome, but at least you get receipts πŸ’€
heads up bestie: --reject literally means some hunks didn't make it in, and they get dumped into ".rej" files instead. that's the deal, fr fr.

🌈 STGIT 🌈

part of the StGit suite β€” see stg(1) for the whole family tree 🫢 iykyk


made with love by the StGit girlies β€” this little gem comes from StGit 2.7.0, dated 10/17/2026 πŸ’– see you in the next patch, bestie! πŸŽ€πŸ¦‹β­
πŸ“¦ where this page comes from