# stg-branch

## 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)
    


* * *