Scroll to navigation

STG-BRANCH(1) StGit Manual STG-BRANCH(1)

NAME

stg-branch - Branch operations: switch, list, create, rename, delete, ...

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.

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

With a single argument, switch to the named branch.

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. Note that @{-<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.

COMMANDS

--list

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.

--create

Create and switch to a new branch. The new branch is initialized as a StGit patch stack. The new branch will be based on the current HEAD, by default, unless an optional committish provided for the base.

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.

--clone

Clone the current branch as <new-branch>, if specified, or using the current branch name with a timestamp.

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.

--rename

Rename an existing branch

--protect

Prevent StGit from modifying a branch

--unprotect

Allow StGit to modify a previously protected branch

--delete

Delete a branch.

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.

--cleanup

Remove StGit patch stack from 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).

--describe

Set the branch description

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)

09/20/2024 StGit 2.4.12