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
--forceoption 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
- opensuse-leap 16.0: stgit 2.7.0-bp160.1.1 Β· GPL-2.0-only
- opensuse-leap 16.0: stgit 2.7.0-bp160.1.1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms