table of contents
STG(1) | StGit Manual | STG(1) |
NAME¶
stg - Manage stacks of patches using the Git content tracker
SYNOPSIS¶
stg [OPTIONS] <command> [...] stg [OPTIONS] <-h|--help> stg --version
DESCRIPTION¶
StGit (Stacked Git) is an application that provides a convenient way to maintain a patch stack on top of a Git branch:
Typical uses¶
Tracking branch
Commands of interest in this workflow are e.g. rebase and mail.
Development branch
Commands of interest in this workflow are e.g. uncommit, which can be used to move the patch stack base downwards — i.e., turn Git commits into StGit patches after the fact — and commit, its inverse.
For more information, see the tutorial[1].
Specifying patches¶
Most StGit commands have patch arguments. Patches in the stack may be specified in a variety of ways. A patch in the current branch may simply referred to by its name, or, alternatively, be located by a relative offset from the topmost patch (e.g. +3), as an absolute index into the stack (e.g. 7), or as an offset from the last visible patch (e.g. ^1).
Some commands allow you to specify a patch in another branch of the repository; this is done by prefixing the patch name with the branch name and a colon (e.g. otherbranch:thatpatch).
Commands that take multiple patch arguments may be supplied with patch ranges of the form patch1..patchN as an alternative to specifying each patch individually. For example, stg delete p0..p4 would be equivalent to stg delete p0 p1 p2 p3 p4. Patch ranges may be open on either or both ends. For example, stg delete ..p2 would delete the first applied patch up to and including patch p2. Alternatively, stg delete p2.. would delete patch p2 up to and including the topmost applied patch. And stg delete .. would delete all applied patches.
The complete syntax for locating patches follows:
<patchname>, e.g. patch
@
[<patchname>]~[<n>], e.g. ~2, patch~, patch~3
[<patchname>]+[<n>], e.g. +, +3, patch+, patch+3
-[<n>], e.g. -3, -
<n>, e.g. 3
^[<n>], e.g. ^, ^3
{base}+[<n>], e.g. {base}+, {base}+3
Take note that numeric patch locations of the form <n>, -<n>, and +<n>, e.g. 3, -3, or +3 are also valid patch names. I.e. it is possible (but not recommended) to name a patch, for example, "-3". In the case where a patch name could also be interpreted as a numeric index or offset, the literal patch name will take precidence when resolving the patch location.
Specifying commits¶
Some StGit commands take Git commits as arguments. StGit accepts all revision specifications that Git does (see gitrevisions(7)); and additionally, the patch specifiers from above. The usual Git modifiers, including ^, are also allowed; e.g. some-branch:a-patch^^ refers to the grandparent of the commit that is patch a-patch on branch some-branch.
If you need to pass a given StGit reference to a Git command, stg-id(1) will convert it to a Git commit id for you.
OPTIONS¶
The following generic option flags are available. Additional options are available for (and documented with) the different subcommands.
--version
--help
-C
This option affects arguments that expect path names or path specs in that their interpretations of the path names would be made relative to the working directory caused by the -C option.
--color <when>
auto (the default) enables colored output only when outputting to a terminal or TTY. The NO_COLOR environment variable is respected.
always and never unconditionlly enable/disable colored output, respectively.
ansi forces color to be output using ANSI escape sequences, even in a Windows console.
STGIT COMMANDS¶
We divide StGit commands in thematic groups, according to the primary type of object they create or change.
Here is a short description of each command. A more detailed description is available in individual command manpages. Those manpages are named stg-<command>(1).
Patch Inspection¶
Patch Manipulation¶
Stack Inspection¶
Stack Manipulation¶
Administration¶
CONFIGURATION MECHANISM¶
StGit uses the same configuration mechanism as Git. See git-config(1) for more details.
Variables¶
branch.<name>.stgit.autostash, branch.<name>.stgit.fetchcmd, branch.<name>.stgit.pull-policy, branch.<name>.stgit.pullcmd, branch.<name>.stgit.rebasecmd
branch.<name>.stgit.parentbranch
stgit.alias.*
If the alias expansion is prefixed with an exclamation point (!), it will be treated as a shell command. For example, defining stgit.alias.outgoing = !git log @{u}, running stg outgoing is equivalent to running the shell command git log @{u}. Note that shell commands will be executed from the top-level directory of the working tree, which may not necessarily be the current directory. GIT_PREFIX is set as returned by running git rev-parse --show-prefix from the original current directory. See git-rev-parse(1).
Aliases that would hide existing StGit commands are ignored.
stgit.autoimerge
stgit.autosign
stgit.autostash
stgit.diff-opts
stgit.edit.verbose
stgit.editor
stgit.fetchcmd
stgit.gpgsign
N.B. Set commit.gpgsign to determine whether patch commits themselves are GPG signed. See git-config(1) for more information about commit.gpgsign.
stgit.import.message-id
stgit.keepoptimized
stgit.namelength
Automatically generated patch names are truncated at word boundaries less than or equal to the value of stgit.namelength. As a result, patch names will typically not be truncated at exactly this number of characters. It is also possible for automatically generated patch names to be longer than this value if a work boundary cannot be found within this bound, or if additional characters need to be added to the patch name to make it unique.
stgit.pick.expose-format
stgit.pull-policy
stgit.pullcmd
stgit.push.allow-conflicts
When set to false, a patch that would have merge conflicts will not be pushed, thus leaving the stack on the last patch that could be pushed without conflicts.
This configuration variable may be overridden on the command line with either --conflicts[=allow] or --conflicts=disallow.
N.B.: stgit.autoimerge only has an affect when push conflicts are allowed.
stgit.rebasecmd
stgit.refreshsubmodules
stgit.shortnr
TEMPLATES¶
A number of StGit commands make use of template files to provide useful default texts to be edited by the user. These <name>.tmpl template files are searched in the following directories:
NOTES¶
- 1.
- tutorial
09/20/2024 | StGit 2.4.12 |