STG-EXPORT(1)

✨ STG-EXPORT(1) β€” the StGit manual, bestie edition ✨

okay so real talk, this is a page from the StGit Manual, and it's about stg-export, which is lowkey one of the most underrated lil commands in the whole suite. buckle up πŸŽ€


🌸 NAME 🌸

stg-export β€” export patches to a directory. that's it, that's the whole vibe. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

stg export [OPTIONS] [patch]...

πŸ’– DESCRIPTION πŸ’–

so what it does is: it takes a range of patches and exports them to a given directory in unified diff format. iconic. and by default, all applied patches get exported β€” not me just assuming you wanted that, it literally is the default 😌

where do they go? patches land in patches-<branch> by default (yep, the directory name is literally built from the branch name). if that's not your vibe, the --dir option lets you specify a different output directory. slay.

and here's the fun part β€” you can customize the patch file output via a template file, which gets found at one of these spots:

"$GIT_DIR/patchexport.tmpl", "~/.stgit/templates/patchexport.tmpl", or "$(prefix)/share/stgit/templates".

and the following variables are supported in the template file, fr fr:

%(description)s - patch description
%(shortdescr)s  - the first line of the patch description
%(longdescr)s   - the rest of the patch description, after the first line
%(diffstat)s    - the diff statistics
%(authname)s    - author name
%(authemail)s   - author email
%(authdate)s    - patch creation date (ISO-8601 format)
%(commname)s    - committer name
%(commemail)s   - committer email

like, %(authdate)s gives you the patch creation date in ISO-8601 format β€” so tidy of it. 🫢


πŸ’… OPTIONS πŸ’…

  • -b <branch>, --branch=<branch> β€” use <branch> instead of current branch. main character energy: you pick the branch, not the branch pick you.
  • -d <dir>, --dir=<dir> β€” export patches to <dir> instead of the default. you're the director now 🎬
  • -p, --patch β€” suffix patch file names with ".patch". yes bestie, literally that exact string.
  • -e <ext>, --extension=<ext> β€” suffix patch file names with ".<ext>". so like, your own custom extension. cute.
  • -n, --numbered β€” prefix patch file names with order numbers. keeps everything in line, no chaos πŸ’€
  • -t <file>, --template=<file> β€” use <file> as template. this is where you flex your formatting.
  • -s, --stdout β€” export to stdout instead of directory. no files, just vibes (and text) ✨
  • -O <option>, --diff-opt=<option> β€” pass additional <option> to git diff. see the git-diff(1) man page for the details. and heads up: this option may be specified multiple times, so stack 'em if you got 'em.

🌈 STGIT 🌈

part of the StGit suite β€” see stg(1) 🧚


and that's the whole page, bestie β€” go forth and export some patches πŸ’œ

this page ships with StGit 2.7.0, dated 10/17/2026. no cap. πŸ“
πŸ“¦ where this page comes from