STG-BRANCH(1)

✨ STG-BRANCH πŸ’…

okay so this is the stg-branch page straight outta the StGit Manual, and honestly? she's a whole vibe. branch operations girlie. let's get into it πŸŽ€


🌸 NAME 🌸

stg-branch β€” branch operations: switching, listing, creating, renaming, deleting, and like… all of it ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

stg branch
stg branch [--merge] <branch>
stg branch {--list,-l}
stg branch {--create,-c} <new-branch> [committish]
stg branch {--clone,-C} [new-branch]
stg branch {--rename,-r} [old-name] <new-name>
stg branch {--protect,-p} [branch]
stg branch {--unprotect,-u} [branch]
stg branch {--delete,-D} [--force] [branch]
stg branch --cleanup [--force] [branch]
stg branch {--describe,-d} <description> [branch]

πŸ’– DESCRIPTION πŸ’–

Create, clone, switch, rename, or delete StGit-enabled branches. that's the whole gig, no cap πŸ’…

With no arguments, the current branch is printed to stdout. simple. iconic.

With a single argument, switch to the named branch. like walking into a different group chat 🫢

StGit supports specifying a branch using the @{-<n>} syntax supported by git, including - as a synonym for @{-1}. Thus stg branch - may be used to switch to the last checked-out HEAD. ⚠️ but heads up bestie: @{-<n>} refers to the *<n>*th last HEAD, which is not necessarily a local branch. Using an @{-<n>} value that refers to anything but a local branch will result in an error. read that again. i'll wait πŸ’€


🌈 COMMANDS 🌈

⭐ --list, -l

List each branch in the current repository along with its description, if any. the current branch is prefixed with >. branches initialized with StGit stacks are prefixed with s. protected branches are prefixed with p. little prefix lore, iykyk πŸ‘‘

🧚 --create, -c

Create and switch to a new branch. the new branch is initialized as a StGit patch stack. by default it'll be based on the current HEAD, unless you hand it an optional committish as the base. fresh start energy ✨

StGit attempts to detect the branch from which the new branch forked, as well as the remote repository of that parent branch, such that stg-pull(1) will pull from the correct remote branch. a warning will be printed if the parent branch cannot be determined. it's giving "we tried our best" πŸ₯Ί

πŸ¦‹ --clone, -C

Clone the current branch as <new-branch> if you specified one, or using the current branch name with a timestamp if you didn't. lazy-girl engineering, love that for us πŸ’…

The description of the new branch will indicate it is a clone of the current branch. the parent information of the new branch is copied from the current branch. matching set πŸŽ€

🌸 --rename, -r

Rename an existing branch. glow-up, name edition.

πŸ’œ --protect, -p

Prevent StGit from modifying a branch. protective queen behavior, we stan πŸ›‘οΈ

🫢 --unprotect, -u

Allow StGit to modify a previously protected branch. the shield comes off.

πŸ’€ --delete, -D

Delete a branch. bye bestie πŸ‘‹

  • the branch will not be deleted if there are any patches remaining unless the --force option is provided.
  • if the current branch is selected for deletion, its parent branch must be configured and the worktree must be clean. the parent branch will be checked-out after the current branch is deleted.
  • a protected branch may not be deleted; it must be unprotected first.
real talk: none of those are suggestions, they're rules. respect the rules or the command just refuses. 😭

🧹 --cleanup

Remove the StGit patch stack from a branch. the operation will be refused if any patches remain, unless the --force option is provided.

A protected branch will not be cleaned up; it must be unprotected first.

A cleaned up branch may be reinitialized using stg-init(1). recycling is iconic ♻️

πŸ’… --describe, -d

Set the branch description. give her a little bio.


πŸ”₯ OPTIONS πŸ”₯

  • --merge β€” merge work tree changes into the other branch

πŸ“ --DELETE OPTIONS

  • --force β€” force deletion even if branch has patches

⭐ --CLEANUP OPTIONS

  • --force β€” force clean up even if branch has patches

πŸ‘‘ STGIT πŸ‘‘

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


okay that's the page!! and for the record, this beauty is StGit 2.7.0, dated 10/17/2026 β€” write it down, take a screenshot, tell your friends. periodt. 🌈✨

πŸ“¦ where this page comes from