STG-REFRESH(1)

πŸ’… stg-refresh β€” the StGit manual, bestie edition ✨

Okay so real talk: this is stg-refresh from the StGit manual, and it's about to become your new favorite command. Buckle up πŸŽ€


🌸 NAME 🌸

stg-refresh β€” the icon that scoops up all your worktree changes and tucks them into the current patch πŸ‘‘

✨ SYNOPSIS ✨

stg refresh [OPTIONS] [path]...

πŸ’– DESCRIPTION πŸ’–

So here's the vibe: stg refresh takes the latest work tree and index changes and folds them into the current patch. It literally generates a brand new git commit object for that patch β€” meaning the old commit? Gone. Not visible anymore. Poof πŸ’¨ (so like, don't come looking for it).

Now, the important part, bestie, listen up πŸ‘‚: refresh will warn you if the index is dirty, and it will require you to use either the --index or --force options to override that check. Why? Because it's protecting you 🫢 β€” it doesn't want you accidentally doing a full refresh when you only staged some of your changes using git add interactive mode. That would be a mess and nobody wants that.

You can optionally list one or more files or directories relative to the current working directory β€” and if you do, only the matching files get updated. Slay, selective πŸ¦‹

Behind the scenes (iykyk), stg refresh first creates a new temporary patch with all your updates, then merges that temp patch into the patch you asked to refresh. And here's the tea β˜•: if you asked to refresh a patch that isn't the topmost patch, there can be conflicts. In that case, the temporary patch gets left behind for you to deal with β€” for example with stg squash. Not me leaving you a little homework πŸ™ˆ

Also, the creation of that temporary patch gets recorded in a separate entry in the patch stack log. Which means: one undo step undoes the merge between the other patch and the temp patch, and two undo steps additionally gets rid of the temp patch entirely. Two-for-one undo realness ✨


πŸ”₯ OPTIONS πŸ”₯

  • -u, --update β€” only update the current patch files. Just the current ones. That's it πŸ’…
  • -i, --index β€” instead of setting the patch top to the current contents of the worktree, set it to the current contents of the index. Different source, same energy 🌈
  • -F, --force β€” instead of warning you when some work has already been staged (like with git add interactive mode), just force a full refresh. Warning? Skipped. Sent to voicemail πŸ“΅
  • --conflicts[=<policy>] β€” either "allow" or "disallow" pushing a patch with conflicts.

Using --conflicts=allow (or just plain --conflicts) allows pushing a patch that may result in unresolved merge conflicts. The patch will be pushed and files with conflicts will be left with conflict markers for you to resolve manually 😭 β€” or you can undo the whole operation with stg undo --hard. This is the default behavior, and it also corresponds to the "stgit.push.allow-conflicts" variable being set to "true".

Using --conflicts=disallow disallows pushing any patch that would result in merge conflicts. The operation will stop on the last patch that can be pushed without conflicts. You can configure this behavior by setting "stgit.push.allow-conflicts" to "false".

  • -p <patch>, --patch=<patch> β€” refresh (applied) <patch> instead of the top patch. Mixing it up, love that πŸŽ€
  • -a <note>, --annotate=<note> β€” annotate the patch log entry with <note> πŸ“
  • --submodules β€” include submodules in patch content 🧚
  • --no-submodules β€” exclude submodules in patch content πŸ§šβ€β™€οΈ (the opposite one)
  • -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 editor, deliver the words πŸ’¬
  • -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. Stack '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. Live in the moment ⏰

  • --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. Time travel, but make it git πŸ•°οΈ
Heads up bestie: refresh warns on a dirty index and makes you pass --index or --force to get past it. And if you refresh a non-topmost patch, conflicts can happen and the temp patch stays behind for you. That's canon, not a glitch πŸ’€

🫢 STGIT 🫢

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


That's the whole page, no cap. Brought to you by StGit 2.7.0, dated 10/17/2026 β€” go forth and refresh, you absolute main character πŸŒŸπŸ’–

πŸ“¦ where this page comes from