STG-NEW(1)

🌸 stg-new β€” bestie edition πŸ’…

okay so this is stg-new(1) from the StGit Manual, and it's literally the glow-up command for your patch stack. new patch, top of the stack, main character energy. let's get into it πŸŽ€


✨ NAME ✨

stg-new β€” create a new patch at the top of the stack 🫢


🌈 SYNOPSIS 🌈

stg new [OPTIONS] [patchname] [-- <path>...]
stg new [OPTIONS] [--name <patchname>] [-- <path>...]

two ways to say it, same vibe, no cap ✨


πŸ’– DESCRIPTION πŸ’–

Okay so what this does is create a new, empty patch on the current stack. the new patch gets created on top of the currently applied patches, and it's made the new top of the stack. like, it gets promoted to top of the group chat, instantly πŸ‘‘

big thing though β€” uncommitted changes in the work tree are not included in the patch. that's stg-refresh's job, not this one's, so don't come for this command about it 😭

the given patch name has to be unique in the stack, fr fr, no duplicates allowed. if you don't give a name, one gets generated from the first line of the patch's commit message. automatic slay.

patch names follow the rules for Git references, with the extra constraint that patch names may not contain the / character. if you need details, see git-check-ref-format(1). πŸ¦‹

patch names may start with a leading -. when you're specifying one of those on the command line, you can escape the leading - with a single backslash, like \-patch-name, so the command doesn't get confused between your patch name and an option. iykyk ✨

an editor will launch so you can edit the commit message that'll be used for the patch β€” unless the --message flag already specified one, in which case you're done, periodt. the patchdescr.tmpl template file (if it's available) is used to pre-fill the editor. ✨


πŸ’… OPTIONS πŸ’…

  • -n <name>, --name=<name> β€” alternative to the [patchname] argument for specifying the name of the new patch. this option lets the patch name start with an unescaped leading - πŸ‘‘
  • -r, --refresh β€” refresh the new patch with changes from the work tree. new patches are empty by default, but with this option the new patch captures outstanding changes in the work tree, as if stg-refresh(1) was run. use --index to refresh from the index instead of the work tree. 🫢
  • -i, --index β€” instead of refreshing the patch with the current contents of the worktree, use the current contents of the index. swap the source, still slay πŸ’…
  • -F, --force β€” force refresh with staged and unstaged changes.
by default, if there are staged changes in the index along with unstaged changes in the work tree, the command will abort. this option forces the command to proceed using both the staged and unstaged changes. drama avoided (or caused, depending on your intentions) 😭
  • --submodules β€” include submodules in patch content 🧚
  • --no-submodules β€” exclude submodules in patch content 🧚
  • -e, --edit β€” invoke editor for patch description ✍️
  • -d, --diff β€” show diff when editing patch description
  • -m <message>, --message=<message> β€” use message instead of invoking the editor. skip the whole editor moment, just say it 🌸
  • -f <path>, --file=<path> β€” use the contents of file instead of invoking the editor. use - to read from stdin. πŸ“
  • --no-verify β€” disable commit-msg hook
  • -s[=<value>], --signoff[=<value>] β€” add Signed-off-by message trailer.

the value is optional and defaults to the committer name and email. this option may be provided multiple times. pile 'em up πŸ’–

  • --ack[=<value>] β€” add Acked-by message trailer.

the value is optional and defaults to the committer's name and email. this option may be provided multiple times. ✨

  • --review[=<value>] β€” add Reviewed-by message trailer.

the value is optional and defaults to the committer's name and email. this option may be provided multiple times. ✨

  • --author=<name-and-email> β€” set the author "name <email>"
  • --authname=<name> β€” set the author name
  • --authemail=<email> β€” set the author email
  • --authdate=<date> β€” set the date the patch was authored.

use "now" to use the current time and date. ⏰

  • --committer-date-is-author-date β€” instead of using the current time as the committer date, use the author date of the commit as the committer date. matching timestamps, cute πŸ”₯
  • --save-template=<file> β€” instead of running the command, just write the patch description to FILE, and exit. (if FILE is -, write to stdout.) 🫢

when driving StGit from another program, it may be useful to first call a command with --save-template, then let the user edit the message, and then call the same command with --file. big brain workflow, ngl 🧠✨


🌟 STGIT 🌟

part of the StGit suite β€” see stg(1) πŸ’œ


and that's the whole thing, bestie πŸŽ€ this page is StGit 2.7.0, dated 10/17/2026, and honestly? iconic. go make some patches, you're literally the main character of this stack πŸ‘‘πŸ’–

πŸ“¦ where this page comes from