Fix a typo in the fold command help
[stgit] / README
CommitLineData
41a6d859
CM
1Stacked GIT
2-----------
3
4StGIT is a Python application providing similar functionality to Quilt
5(i.e. pushing/poping patches to a stack) on top of GIT. These
6operations are performed using the GIT merge algorithms.
7
8Note that StGIT is not an SCM interface for GIT. Use the GIT commands
9or some other tools like Cogito for this.
10
11For the latest version see http://www.procode.org/stgit/
12
13
14Basic Operations
15----------------
16
17For a full list of commands:
18
19 stg help
20
21For help on individual commands:
22
23 stg <cmd> (-h | --help)
24
25To initialise a tree (the tree must have been previously initialised
26with GIT):
27
28 stg init
29
30To add/delete files:
31
32 stg add [<file>*]
33 stg rm [<file>*]
34
35To inspect the tree status:
36
37 stg status
38
39To get a diff between 2 revisions:
40
41 stg diff [-r rev1[:[rev2]]]
42
43A revision name can be of the form '([patch]/[bottom | top]) | <tree-ish>'
44If the patch name is not specified but '/' is passed, the topmost
45patch is considered. If neither 'bottom' or 'top' follows the '/', the
46whole patch diff is displayed (this does not include the local
47changes).
48
49Note than when the first patch is pushed to the stack, the current
50HEAD is saved in the .git/refs/heads/base file for easy reference.
51
52To create/delete a patch:
53
54 stg new <name>
55 stg delete [<name or topmost>]
56
57The 'new' command also sets the topmost patch to the newly created
58one.
59
60To push/pop a patch to/from the stack:
61
62 stg push [<name or first unapplied>]
63 stg pop [<name or topmost>]
64
65Note that the 'push' command can apply any patch in the unapplied
66list. This is useful if you want to reorder the patches.
67
68To add the patch changes to the tree:
69
70 stg refresh
71
72To inspect the patches applied:
73
74 stg series
75 stg applied
76 stg unapplied
77 stg top
78
79To export a patch series:
80
81 stg export [<dir-name or 'patches'>]
82
83The 'export' command supports options to automatically number the
84patches (-n) or add the '.diff' extension (-d).
85
86StGIT does not yet provide support for cloning or pulling changes from
87a different repository. Until this becomes available, run the
88following commands:
89
90 stg pop -a
91 your-git-script-for-pulling-and-merging
92 stg push -a
93
94You can also look in the TODO file for what's planned to be
95implemented in the future.
96
97
98Directory Structure
99-------------------
100
101.git/
102 objects/
103 ??/
104
105refs/
106 heads/
107 master - the master commit id
108 ...
109 bases/
110 master - the bottom id of the stack (to get a big diff)
111 ...
112 tags/
113 ...
114 branches/
115 ...
116 patches/
117 master/
118 applied - list of applied patches
119 unapplied - list of not-yet applied patches
120 current - name of the topmost patch
121 patch1/
122 first - the initial id of the patch (used for log)
123 bottom - the bottom id of the patch
124 top - the top id of the patch
125 patch2/
126 ...
127 ...
128
129HEAD -> refs/heads/<something>
130
131
132A Bit of StGIT Patch Theory
133---------------------------
134
135We assume that a patch is a diff between two nodes - bottom and top. A
136node is a commit SHA1 id or tree SHA1 id in the GIT terminology:
137
138P - patch
139N - node
140
141P = diff(Nt, Nb)
142
143 Nb - bottom (start) node
144 Nt - top (end) node
145 Nf - first node (for log generation)
146
147For an ordered stack of patches:
148
149P1 = diff(N1, N0)
150P2 = diff(N2, N1)
151...
152
153Ps = P1 + P2 + P3 + ... = diff(Nst, Nsb)
154
155 Ps - the big patch of the whole stack
156 Nsb - bottom stack node (= N0)
157 Nst - top stack node (= Nn)
158
159Applying (pushing) a patch on the stack (Nst can differ from Nb) is
160done by diff3 merging. The new patch becomes:
161
162P' = diff(Nt', Nb')
163Nb' = Nst
164Nt' = diff3(Nst, Nb, Nt)
165
166(note that the diff3 parameters order is: branch1, ancestor, branch2)
167
168The above operation allows easy patch re-ordering.
169
170Removing (popping) a patch from the stack is done by simply setting
171the Nst to Nb.