stgit.el: Improve stgit-mode help text slightly
[stgit] / Documentation / stg.txt
... / ...
CommitLineData
1stg(1)
2======
3Yann Dirson <ydirson@altern.org>
4
5NAME
6----
7stg - Manage stacks of patches using the Git content tracker
8
9SYNOPSIS
10--------
11[verse]
12'stg' [--version | --help]
13'stg' [--help <command> | <command> --help]
14'stg' <command> [COMMAND OPTIONS] [ARGS]
15
16DESCRIPTION
17-----------
18
19StGit (Stacked Git) is an application that provides a convenient way
20to maintain a 'patch stack' on top of a Git branch:
21
22 * The topmost (most recent) commits of a branch are given names.
23 Such a named commit is called a 'patch'.
24
25 * After making changes to the worktree, you can incorporate the
26 changes into an existing patch; this is called 'refreshing'. You
27 may refresh any patch, not just the topmost one.
28
29 * You can 'pop' a patch: temporarily putting it aside, so that the
30 patch below it becomes the topmost patch. Later you may 'push' it
31 onto the stack again. Pushing and popping can be used to reorder
32 patches.
33
34 * You can easily 'rebase' your patch stack on top of any other Git
35 commit. (The 'base' of a patch stack is the most recent Git commit
36 that is not an StGit patch.) For example, if you started making
37 patches on top of someone else's branch, and that person publishes
38 an updated branch, you can take all your patches and apply them on
39 top of the updated branch.
40
41 * As you would expect, changing what is below a patch can cause that
42 patch to no longer apply cleanly -- this can occur when you
43 reorder patches, rebase patches, or refresh a non-topmost patch.
44 StGit uses Git's rename-aware three-way merge capability to
45 automatically fix up what it can; if it still fails, it lets you
46 manually resolve the conflict just like you would resolve a merge
47 conflict in Git.
48
49 * The patch stack is just some extra metadata attached to regular
50 Git commits, so you can continue to use most Git tools along with
51 StGit.
52
53Typical uses
54~~~~~~~~~~~~
55
56Tracking branch::
57
58 Tracking changes from a remote branch, while maintaining local
59 modifications against that branch, possibly with the intent of
60 sending some patches upstream. You can modify your patch stack as
61 much as you want, and when your patches are finally accepted
62 upstream, the permanent recorded Git history will contain just the
63 final sequence of patches, and not the messy sequence of edits that
64 produced them.
65+
66Commands of interest in this workflow are e.g. linkstgsub:rebase[] and
67linkstgsub:mail[].
68
69Development branch::
70
71 Even if you have no "upstream" to send patches to, you can use StGit
72 as a convenient way to modify the recent history of a Git branch.
73 For example, instead of first committing change 'A', then change
74 'B', and then 'A2' to fix 'A' because it wasn't quite right, you
75 could incorporate the fix directly into 'A'. This way of working
76 results in a much more readable Git history than if you had
77 immortalized every misstep you made on your way to the right
78 solution.
79+
80Commands of interest in this workflow are e.g. linkstgsub:uncommit[],
81which can be used to move the patch stack base downwards -- i.e., turn
82Git commits into StGit patches after the fact -- and
83linkstgsub:commit[], its inverse.
84
85For more information, see htmllink:tutorial.html[the tutorial].
86
87Specifying patches
88~~~~~~~~~~~~~~~~~~
89
90Many StGit commands take references to StGit patches as arguments.
91Patches in the stack are identified with short names, each of which
92must be unique in the stack.
93
94Patches in the current branch are simply referred to by their name.
95Some commands allow you to specify a patch in another branch of the
96repository; this is done by prefixing the patch name with the branch
97name and a colon (e.g. +otherbranch:thatpatch+).
98
99Specifying commits
100~~~~~~~~~~~~~~~~~~
101
102Some StGit commands take Git commits as arguments. StGit accepts all
103commit expressions that Git does; and in addition, a patch name
104(optionally prefixed by a branch name and a colon) is allowed in this
105context. The usual Git modifiers $$^$$ and $$~$$ are also allowed;
106e.g., +abranch:apatch~2+ is the grandparent of the commit that is the
107patch +apatch+ on branch +abranch+.
108
109Instead of a patch name, you can say +$${base}$$+ to refer to the
110stack base (the commit just below the bottommost patch); so,
111+abranch:$${base}$$+ is the base of the stack in branch +abranch+.
112
113If you need to pass a given StGit reference to a Git command,
114linkstg:id[] will convert it to a Git commit id for you.
115
116OPTIONS
117-------
118
119The following generic option flags are available. Additional options
120are available for (and documented with) the different subcommands.
121
122--version::
123 Prints the StGit version, as well as version of other components
124 used, such as Git and Python.
125
126--help::
127 Prints the synopsis and a list of all subcommands. If an StGit
128 subcommand is given, prints the synposis for that subcommand.
129
130STGIT COMMANDS
131--------------
132
133We divide StGit commands in thematic groups, according to the primary
134type of object they create or change.
135
136ifdef::backend-docbook[]
137Here is a short description of each command. A more detailed
138description is available in individual command manpages. Those
139manpages are named 'stg-<command>(1)'.
140endif::backend-docbook[]
141
142include::command-list.txt[]
143
144CONFIGURATION MECHANISM
145-----------------------
146
147StGit uses the same configuration mechanism as Git. See manlink:git[7]
148for more details.
149
150TEMPLATES
151---------
152
153A number of StGit commands make use of template files to provide
154useful default texts to be edited by the user. These +<name>.tmpl+
155template files are searched in the following directories:
156
157 . +$GITDIR/+ (in practice, the +.git/+ directory in your repository)
158 . +$HOME/.stgit/templates/+
159 . +/usr/share/stgit/templates/+