tg-info.sh: support --deps and --dependents options
[topgit/pro.git] / README
blob4d76e075a0f3419a522c70c87233b9653e8d0a1b
1 =========================================
2 TopGit -- A different patch queue manager
3 =========================================
6 DESCRIPTION
7 -----------
9 TopGit aims to make handling of large amounts of interdependent topic
10 branches easier. In fact, it is designed especially for the case where
11 you maintain a queue of third-party patches on top of another (perhaps
12 Git-controlled) project and want to easily organize, maintain and submit
13 them -- TopGit achieves that by keeping a separate topic branch for each
14 patch and providing some tools to maintain the branches.
16 See also:
18         :REQUIREMENTS_:     Installation requirements
19         :SYNOPSIS_:         Command line example session
20         :USAGE_:            Command line details
21         :`NO UNDO`_:        Where's the undo!!!
22         :CONVENTIONS_:      Suggestions for organizing your TopGit branches
23         :`EXTRA SETTINGS`_: Various possible "topgit.*" config settings
24         :ALIASES_:          Git-like TopGit command aliases
25         :NAVIGATION_:       Getting around with "next" and "prev"
26         :GLOSSARY_:         All the TopGit vocabulary in one place
27         :TECHNICAL_:        How it works behind the scenes
30 REQUIREMENTS
31 ------------
33 TopGit is a collection of POSIX shell scripts so a POSIX-compliant shell is
34 required along with some standard POSIX-compliant utilities (e.g. sed, awk,
35 cat, etc.).  Git version 1.8.5 or later is also required.
37 To use TopGit with linked working trees (the ``git worktree add`` command),
38 at least Git version 2.5.0 (obviously, since that's when the ``git worktree``
39 command first appeared) is needed in which case linked working trees are then
40 fully supported for use with TopGit.
42 The scripts need to be preprocessed and installed and currently the Makefile
43 that does this requires GNU make, but that's an install-time-only requirement.
45 It is possible, however, to use the DESTDIR functionality to install TopGit to
46 a staging area on one machine, archive that and then unarchive it on another
47 machine to perform an install (provided the build prefix and other options are
48 compatible with the final installed location).
51 INSTALLATION
52 ------------
54 See the file ``INSTALL``.
57 GIT REPOSITORY
58 --------------
60 The TopGit git repository can be found at <http://repo.or.cz/topgit/pro>.
63 RATIONALE
64 ---------
66 Why not use something like StGIT or Guilt or ``rebase -i`` for maintaining
67 your patch queue?  The advantage of these tools is their simplicity;
68 they work with patch *series* and defer to the reflog facility for
69 version control of patches (reordering of patches is not
70 version-controlled at all).  But there are several disadvantages -- for
71 one, these tools (especially StGIT) do not actually fit well with plain
72 Git at all: it is basically impossible to take advantage of the index
73 effectively when using StGIT.  But more importantly, these tools
74 horribly fail in the face of a distributed environment.
76 TopGit has been designed around three main tenets:
78         (i) TopGit is as thin a layer on top of Git as possible.  You
79         still maintain your index and commit using Git; TopGit will only
80         automate a few indispensable tasks.
82         (ii) TopGit is anxious about *keeping* your history.  It will
83         never rewrite your history, and all metadata is also tracked
84         by Git, smoothly and non-obnoxiously.  It is good to have a
85         *single* point when the history is cleaned up, and that is at
86         the point of inclusion in the upstream project; locally, you
87         can see how your patch has evolved and easily return to older
88         versions.
90         (iii) TopGit is specifically designed to work in a
91         distributed environment.  You can have several instances of
92         TopGit-aware repositories and smoothly keep them all
93         up-to-date and transfer your changes between them.
95 As mentioned above, the main intended use-case for TopGit is tracking
96 third-party patches, where each patch is effectively a single topic
97 branch.  In order to flexibly accommodate even complex scenarios when
98 you track many patches where many are independent but some depend on
99 others, TopGit ignores the ancient Quilt heritage of patch series and
100 instead allows the patches to freely form graphs (DAGs just like Git
101 history itself, only "one level higher").  For now, you have to manually
102 specify which patches the current one depends on, but TopGit might help
103 you with that in the future in a darcs-like fashion.
105 A glossary_ plug: The union (i.e. merge) of patch dependencies is called
106 a *base* of the patch (topic branch).
108 Of course, TopGit is perhaps not the right tool for you:
110         (i) TopGit is not complicated, but StGIT et al. are somewhat
111         simpler, conceptually.  If you just want to make a linear
112         purely-local patch queue, deferring to StGIT instead might
113         make more sense.
115         (ii) When using TopGit, your history can get a little hairy
116         over time, especially with all the merges rippling through.
117         ;-)
120 SYNOPSIS
121 --------
125         ## Create and evolve a topic branch
126         $ tg create t/gitweb/pathinfo-action
127         tg: Automatically marking dependency on master
128         tg: Creating t/gitweb/pathinfo-action base from master...
129         $ ..hack..
130         $ git commit
131         $ ..fix a mistake..
132         $ git commit
134         ## Create another topic branch on top of the former one
135         $ tg create t/gitweb/nifty-links
136         tg: Automatically marking dependency on t/gitweb/pathinfo-action
137         tg: Creating t/gitweb/nifty-links base from t/gitweb/pathinfo-action...
138         $ ..hack..
139         $ git commit
141         ## Create another topic branch on top of master and submit
142         ## the resulting patch upstream
143         $ tg create t/revlist/author-fixed master
144         tg: Creating t/revlist/author-fixed base from master...
145         $ ..hack..
146         $ git commit
147         $ tg patch -m
148         tg: Sent t/revlist/author-fixed
149         From: pasky@suse.cz
150         To: git@vger.kernel.org
151         Cc: gitster@pobox.com
152         Subject: [PATCH] Fix broken revlist --author when --fixed-string
154         ## Create another topic branch depending on two others non-trivially
155         $ tg create t/whatever t/revlist/author-fixed t/gitweb/nifty-links
156         tg: Creating t/whatever base from t/revlist/author-fixed...
157         tg: Merging t/whatever base with t/gitweb/nifty-links...
158         Merge failed!
159         tg: Please commit merge resolution and call: tg update --continue
160         tg: It is also safe to abort this operation using `git reset --hard`
161         tg: but please remember you are on the base branch now;
162         tg: you will want to switch to a different branch.
163         $ ..resolve..
164         $ git commit
165         $ tg update --continue
166         $ ..hack..
167         $ git commit
169         ## Update a single topic branch and propagate the changes to
170         ## a different one
171         $ git checkout t/gitweb/nifty-links
172         $ ..hack..
173         $ git commit
174         $ git checkout t/whatever
175         $ tg info
176         Topic Branch: t/whatever (1 commit)
177         Subject: [PATCH] Whatever patch
178         Base: 3f47ebc1
179         Depends: t/revlist/author-fixed t/gitweb/nifty-links
180         Needs update from:
181                 t/gitweb/nifty-links (1 commit)
182         $ tg update
183         tg: Updating base with t/gitweb/nifty-links changes...
184         Merge failed!
185         tg: Please commit merge resolution and call `tg update --continue`
186         tg: (use `tg status` to see more options)
187         $ ..resolve..
188         $ git commit
189         $ tg update --continue
190         tg: Updating t/whatever against new base...
191         Merge failed!
192         tg: Please commit merge resolution and call `tg update --continue`
193         tg: (use `tg status` to see more options)
194         $ ..resolve..
195         $ git commit
196         $ tg update --continue
198         ## Update a single topic branch and propagate the changes
199         ## further through the dependency chain
200         $ git checkout t/gitweb/pathinfo-action
201         $ ..hack..
202         $ git commit
203         $ git checkout t/whatever
204         $ tg info
205         Topic Branch: t/whatever (1/2 commits)
206         Subject: [PATCH] Whatever patch
207         Base: 0ab2c9b3
208         Depends: t/revlist/author-fixed t/gitweb/nifty-links
209         Needs update from:
210                 t/gitweb/pathinfo-action (<= t/gitweb/nifty-links) (1 commit)
211         $ tg update
212         tg: Recursing to t/gitweb/nifty-links...
213         [t/gitweb/nifty-links] tg: Updating base with t/gitweb/pathinfo-action changes...
214         Merge failed!
215         [t/gitweb/nifty-links] tg: Please commit merge resolution and call `tg update --continue`
216         [t/gitweb/nifty-links] tg: (use `tg status` to see more options)
217         $ ..resolve..
218         $ git commit
219         $ tg update --continue
220         [t/gitweb/nifty-links] tg: Updating t/gitweb/nifty-links against new base...
221         Merge failed!
222         [t/gitweb/nifty-links] tg: Please commit merge resolution and call `tg update --continue`
223         [t/gitweb/nifty-links] tg: (use `tg status` to see more options)
224         $ ..resolve..
225         $ git commit
226         $ tg update --continue
227         tg: Updating base with t/gitweb/nifty-links changes...
228         tg: Updating t/whatever against new base...
230         ## Clone a TopGit-controlled repository
231         $ git clone URL repo
232         $ cd repo
233         $ tg remote --populate origin
234         ...
235         $ git fetch
236         $ tg update
238         ## Add a TopGit remote to a repository and push to it
239         $ git remote add foo URL
240         $ tg remote foo
241         $ tg push -r foo
243         ## Update from a non-default TopGit remote
244         $ git fetch foo
245         $ tg -r foo summary
246         $ tg -r foo update
249 CONVENTIONS
250 -----------
252 When using TopGit there are several common conventions used when working with
253 TopGit branches.  None of them are enforced, they are only suggestions.
255 There are three typical uses for a TopGit branch:
257     1. [PATCH]
258        Normal TopGit branches that represent a single patch.  These are known
259        as "patch" TopGit branches.
260     2. [BASE]
261        Empty TopGit branches with no dependencies (an empty ``.topdeps`` file)
262        that represent a base upon which other "normal" TopGit branches depend.
263        These are known as "base" TopGit branches (not to be confused with
264        the refs/top-bases/... refs).
265     3. [STAGE]
266        Empty TopGit branches that serve as a staging area to bring together
267        several other TopGit branches into one place so they can be used/tested
268        all together.  These are known as "stage" TopGit branches.
270 An "empty" TopGit branch is one that does not have any changes of its own --
271 it may still have dependencies though ("stage" branches do, "base" branches do
272 not).  The ``tg summary`` output shows empty branches with a ``0`` in the
273 listing.  Normal "patch" branches that have not been annihilated, "base" and
274 "stage" branches fall into this category.  (Annihilated branches are normally
275 omitted from the ``tg summary`` output but can be shown if given explicitly as
276 an argument to the ``tg summary`` command.  However, the message line will be
277 incorrect since an annihilated branch has no ``.topmsg`` file of its own.)
279 A "patch" branch name typically starts with ``t/`` whereas "base" and "stage"
280 branch names often do not.
282 A "base" branch is created by using the ``--base`` option of ``tg create``
283 (aka ``--no-deps``) which will automatically suggest a "[BASE]" message prefix
284 rather than "[PATCH]".  A "stage" branch is created like a normal patch branch
285 except that the only changes that will ever be made to it are typically to
286 add/remove dependencies.  Its subject prefix must be manually changed to
287 "[STAGE]" to reflect its purpose.
289 Since both "base" and "stage" branches typically only have a use for the
290 "Subject:" line from their ``.topmsg`` file, they are quite easily created
291 using the ``--topmsg`` option of ``tg create``.
293 Use of "stage" and "base" branches is completely optional.  However, without
294 use of a "stage" branch it will be difficult to test multiple independent
295 patches together all at once.  A "base" branch is merely a convenience that
296 provides more explicit control over when a common base for a set of patches
297 gets updated as well as providing a branch that shows in ``tg summary`` output
298 and participates in ``tg remote --populate`` setup.
300 Another advantage to using a "stage" branch is that if a new "patch" branch
301 is created remotely and that new branch is added to a pre-existing "stage"
302 branch on the remote then when the local version of the "stage" branch is
303 updated (after fetching remote updates of course), that new dependency will
304 be merged into the local "stage" branch and the local version of the new remote
305 "patch" branch will be automatically set up at "tg update" time.
307 When using the ``tg tag`` command to create tags that record the current state
308 of one or more TopGit branches, the tags are often created with a name that
309 starts with ``t/``.
311 One last thing, you have enabled ``git rerere`` haven't you?
314 NO UNDO
315 -------
317 Beware, there is no "undo" after running a ``tg update``!
319 Well, that's not entirely correct.  Since ``tg update`` never discards commits
320 an "undo" operation is technically feasible provided the old values of all the
321 refs that were affected by the ``tg update`` operation can be determined and
322 then they are simply changed back to their previous values.
324 In practice though, it can be extremely tedious and error prone looking through
325 log information to try and determine what the correct previous values were.
326 Although, since TopGit tries to make sure reflogs are enabled for top-bases
327 refs, using Git's ``@{date}`` notation on all the refs dumped out by a
328 ``tg tag --refs foo``, where "foo" is the branch that was updated whose update
329 needs to be undone, may work.
331 Alternatively, ``tg tag --stash`` can be used prior to the update and then
332 ``tg revert`` used after the update to restore the previous state.  This
333 assumes, of course, that you remember to run ``tg tag --stash`` first.
335 The ``tg update`` command understands a ``--stash`` option that tells it to
336 automatically run ``tg tag --stash`` before it starts making changes (if
337 everything is up-to-date it won't run the stash command at all).
339 The ``--stash`` option is the default nowadays when running ``tg update``,
340 add the ``--no-stash`` option to turn it off.
342 There is a preference for this.  Setting the config value ``topgit.autostash``
343 to ``false`` will implicitly add the ``--no-stash`` option to any ``tg update``
344 command unless an explicit ``--stash`` option is given.
346 If you are likely to ever want to undo a ``tg update``, setting
347 ``topgit.autostash`` to ``false`` is highly discouraged!
349 Note that the tags saved by ``tg tag --stash`` are stored in the
350 ``refs/tgstash`` ref and its reflog.  Unfortunately, while Git is happy to
351 maintain the reflog (once it's been enabled which ``tg tag`` guarantees for
352 ``refs/tgstash``), Git is unable to view an annotated/signed tag's reflog!
353 Instead Git dereferences the tag and shows the wrong thing.  Use the
354 ``tg tag -g`` command to view the ``refs/tgstash`` reflog instead.
357 EXTRA SETTINGS
358 --------------
360 TopGit supports various config settings:
362         :ALIASES_:              ``topgit.alias.*`` for Git-like command aliases
363         :SEQUESTRATION_:        ``topgit.sequester`` for sequestration control
364         :`tg migrate-bases`_:   ``topgit.top-bases`` for refs bases location
365         :`tg update`_:          ``topgit.autostash`` automatic stash control
366         :`tg patch`_:           ``topgit.from`` From: fixups by ``tg patch``
367         :`REMOTE HANDLING`_:    ``topgit.remote`` TopGit's default remote
370 ALIASES
371 -------
373 These work exactly like Git's aliases except they are stored under
374 ``topgit.alias.*`` instead.  See the ``git help config`` output under
375 the ``alias.*`` section for details.  Do note that while alias nesting is
376 explicitly permitted, a maximum nesting depth of 10 is enforced to help
377 detect accidental aliasing loops from wedging the machine.
379 For example, to create an ``lc`` alias for the ``tg log --compact`` command
380 this command may be used:
384         git config --global topgit.alias.lc "log --compact"
386 To make it specific to a particular repository just omit the ``--global``
387 option from the command.
390 NAVIGATION
391 ----------
392 From Previous to Next
393 ~~~~~~~~~~~~~~~~~~~~~
395 For this section, consider the following patch series, to be applied
396 in numerical order as shown:
400         0001-F_first-patch.diff
401         0002-G_second-builds-on-F.diff
402         0003-H_third-builds-on-G.diff
403         0004-I_fourth-builds-on-H.diff
404         0005-J_fifth-builds-on-I.diff
405         0006-K_sixth-builds-on-J.diff
406         0007-L_last-patch-needs-K.diff
408 If these were applied to some commit in a Git repository, say commit "A"
409 then a history that looks like this would be created:
413         A---F---G---H---I---J---K---L
415 Where the parent of commit "F" is "A" and so on to where the parent of
416 commit "L" is commit "K".
418 If that commit history, from A through L, was then imported into TopGit, one
419 TopGit branch would be created corresponding to each of the commits F
420 through L.  This way, for example, if the fourth patch in the series
421 (``0004-I_...diff``) needs work, the TopGit branch corresponding to its patch
422 can be checked out and changes made and then a new version of its patch
423 created (using ``tg patch``) without disturbing the other patches in the series
424 and when ``tg update`` is run, the patches that "follow" the fourth patch
425 (i.e. 5, 6 and 7) will have their corresponding TopGit branches automatically
426 updated to take into account the changes made to the fourth patch.
428 Okay, enough with the review of TopGit systemology
429 ``````````````````````````````````````````````````
431 Imagine then that you are working on the fourth patch (i.e. you have its
432 branch checked out into the working tree) and you want to move to the following
433 patch in the series because you have a nit to pick with it too.
435 If you can't remember the exact name you might have to fumble around or, you
436 can display the name of the following or "next" patch's branch with the, you
437 guessed it, ``tg next`` command.  Think of "next" as the "next" logical patch
438 in the series or the next following patch.  If the patches are numbered as in
439 the list above, "next" corresponds to the "+1" (plus one) patch.
441 You might have already guessed there's a corresponding ``tg prev`` command
442 which displays the "-1" (minus one) patch.  If these commands (``tg next``
443 and ``tg prev``) are not given a branch name to start at they start at the
444 patch corresponding to the current ``HEAD``.
446 Displaying, however, is not so helpful as actually going there.  That's where
447 the ``tg checkout`` command comes in.  ``tg checkout next`` does a
448 ``git checkout`` of the ``tg next`` branch and, not surprisingly,
449 ``tg checkout prev`` does a ``git checkout`` of the ``tg prev`` branch.  For
450 the lazy a single ``n`` or ``p`` can be used with ``tg checkout`` instead of
451 typing out the entire ``next`` or ``prev``.  Or, for the anal, ``previous``
452 will also be accepted for ``prev``.
454 Referring to the A...L commit graph shown above, I is the parent of J and,
455 conversely, J is the child of I.  (Git only explicitly records the child to
456 parent links, in other words a "child" points to zero or more "parents", but
457 parents are completely clueless about their own children.)
459 For historical reasons, the ``tg checkout`` command accepts ``child`` as a
460 synonym for ``next`` and ``parent`` as a synonym for ``prev``.  However, this
461 terminology can be confusing since Git has "parent" links but ``tg checkout``
462 is referring to the TopGit DAG, not Git's.  Best to just avoid using ``child``
463 or ``parent`` to talk about navigating the TopGit DAG and reserve them
464 strictly for discussing the Git DAG.
466 There may be more than one
467 ``````````````````````````
469 In a simple linear history as shown above there's always only one "next" or
470 "prev" patch.  However, TopGit does not restrict one to only a linear
471 history (although that can make patch exports just a bushel of fun).
473 Suffice it to say that there is always a single linearized ordering for any
474 TopGit patch series since it's always a DAG (Directed Acyclic Graph), but it
475 may not be immediately obvious to the casual observer what that is.
477 The ``tg checkout`` command will display a list to choose from if ``next``
478 or ``prev`` would be ambiguous.
480 Use the ``tg info/checkout --series`` command
481 `````````````````````````````````````````````
483 To see the full, linearized, list of patches with their summary displayed in
484 order from first to last patch in the series, just run the ``tg info --series``
485 command.  It takes the name of any patch in the series automatically using
486 ``HEAD`` if none is given.  It even provides a nice "YOU ARE HERE" mark in
487 the output list helpful to those who have been absent for a time engaging in
488 otherwise distracting activities and need to be reminded where they are.
490 Using ``tg checkout --series`` can take you there (picking from a list) if
491 you've forgotten the way back to wherever you're supposed to be.
493 Don't get pushy, there's just one more thing
494 ````````````````````````````````````````````
496 For historical reasons, ``tg checkout`` with no arguments whatsoever behaves
497 like ``tg checkout next``.  For the same historical reasons, ``tg checkout ..``
498 behaves like ``tg checkout prev`` (think of ``..`` as the "parent" directory
499 and since "parent" means "prev" in this context it will then make sense).
501 Now, for that one more thing.  Consider that you have a pristine "upstream"
502 tarball, repository, source dump or otherwise obtained set of unmodified
503 source files that need to be patched.  View them like so:
507         +-------------------------------+
508         | Unmodified "upstream" source  |
509         | files represented with "A"    |
510         +-------------------------------+
512 Now, add the first patch, 0001, to them and view the result like so:
516         +--------------------------+----+
517         | Patch 0001 represented by "F" |
518         +-------------------------------+
519         | Unmodified "upstream" source  |
520         | files represented with "A"    |
521         +-------------------------------+
523 Not stopping there, "push" patches 2, 3 and 4 onto the stack as well like so:
527         +--------------------------+----+
528         | Patch 0004 represented by "I" |
529         +--------------------------+----+
530         | Patch 0003 represented by "H" |
531         +--------------------------+----+
532         | Patch 0002 represented by "G" |
533         +--------------------------+----+
534         | Patch 0001 represented by "F" |
535         +-------------------------------+
536         | Unmodified "upstream" source  |
537         | files represented with "A"    |
538         +-------------------------------+
540 In other words, to go to the "next" patch in the series it needs to be "push"ed
541 onto the stack.  ``tg checkout`` accepts ``push`` as an alias for ``next``.
543 Similarly to go to the "previous" patch in the series the current one needs
544 to be "pop"ped off the stack.  ``tg checkout`` accepts ``pop`` as an alias
545 for ``prev``.
547 Unfortunately for these aliases, in Git terminology a "push" has quite a
548 different meaning and the ``tg push`` command does something quite different
549 from ``tg checkout push``.  Then there's the matter of using a single letter
550 abbreviation for the lazy -- ``p`` would mean what exactly?
552 ``tg checkout`` continues to accept the ``push`` and ``pop`` aliases for
553 ``next`` and ``prev`` respectively,  but it's best to avoid them since
554 ``push`` has an alternate meaning everywhere else in TopGit and Git and that
555 leaves ``pop`` all alone in the dark.
558 SEQUESTRATION
559 -------------
561 No, this is not a section about budget nonsense.  ;)
563 TopGit keeps its metadata in ``.topdeps`` and ``.topmsg`` files.  In an effort
564 to facilitate cherry-picking and other Git activities on the patch changes
565 themselves while ignoring the TopGit metadata, TopGit attempts to keep all
566 changes to ``.topdeps`` and ``.topmsg`` files limited to commits that do NOT
567 contain changes to any other files.
569 This is a departure from previous TopGit versions that made no such effort.
571 Primarily this affects ``tg create`` and ``tg import`` (which makes use of
572 ``tg create``) as ``tg create`` will commit the initial versions of
573 ``.topdeps`` and ``.topmsg`` for a new TopGit-controlled branch in their own
574 commit instead of mixing them in with changes to other files.
576 The ``pre-commit`` hook will also attempt to separate out any ``.topdeps`` and
577 ``.topmsg`` changes from commits that include changes to other files.
579 It is possible to defeat these checks without much effort (``pre-commit`` hooks
580 can easily be bypassed, ``tg create`` has a ``--no-commit`` option, many Git
581 commands simply do not run the ``pre-commit`` hook, etc.).
583 If you really, really, really, really want to change the default back to the
584 old behavior of previous TopGit versions where no such sequestration took
585 place, then set the ``topgit.sequester`` config variable explicitly to the
586 value ``false``.  But this is not recommended.
589 AMENDING AND REBASING AND UPDATE-REF'ING
590 ----------------------------------------
592 In a word, "don't".
594 It is okay to manually update a top-bases/... ref when a) it has no depedencies
595 (i.e. it was created with the ``tg create`` ``--base`` option) and b) the
596 old top-bases/... ref value can be fast-forwarded to the new top-bases/...
597 value OR the new value contains ALL of the changes in the old value through
598 some other mechanism (perhaps they were cherry-picked or otherwise applied to
599 the new top-bases/... ref).  The same rules apply to non-TopGit-controlled
600 dependencies.  Use the ``tg update --base <branch> <new-ref>`` command to
601 safely make such an update while making it easy to set the merge commit
602 message at the same time.
604 Ignoring this rule and proceeding anyway with a non-fast-forward update to a
605 top-bases/... ref will result in changes present in the new value being merged
606 into the branch (at ``tg update`` time) as expected (possibly with conflicts),
607 but any changes that were contained in the old version of the top-bases/... ref
608 which have been dropped (i.e. are NOT contained in the new version of the
609 top-bases/... ref) will continue to be present in the branch!  To get rid of
610 the dropped commits, one or more "revert" commits will have to be manually
611 applied to the tip of the new top-bases/... value (which will then be merged
612 into the branch at next ``tg update`` time).
614 The only time it's safe to amend, rebase, filter or otherwise rewrite commits
615 contained in a TopGit controlled branch or non-TopGit branch is when those
616 commits are NOT reachable via any other ref!
618 Furthermore, while it is safe to rewrite merge commits (provided they meet the
619 same conditions) the merge commits themselves and the branches they are merging
620 in must be preserved during the rewrite and that can be rather tricky to get
621 right so it's not recommended.
623 For example, if, while working on a TopGit-controlled branch ``foo``, a bad
624 typo is noticed, it's okay to ammend/rebase to fix that provided neither
625 ``tg update`` nor ``tg create`` has already been used to cause some other ref
626 to be able to reach the commit with the typo.
628 If an amend or rerwite is done anyway even though the commit with the typo is
629 reachable from some other ref, the typo won't really be removed.  What will
630 happen instead is that the new version without the typo will ultimately be
631 merged into the other ref(s) (at ``tg update`` time) likely causing a conflict
632 that will have to be manually resolved and the commit with the typo will
633 continue to be reachable from those other refs!
635 Instead just make a new commit to fix the typo.  The end result will end up
636 being the same but without the merge conflicts.
638 See also the discussion in the `NO UNDO`_ section.
641 SPEED AND CACHING
642 -----------------
644 TopGit needs to check many things to determine whether a TopGit branch is
645 up-to-date or not.  This can involve a LOT of git commands for a complex
646 dependency tree.  In order to speed things up, TopGit keeps a cache of results
647 in a ``tg-cache`` subdirectory in the ``.git`` directory.
649 Results are tagged with the original hash values used to get that result so
650 that items which have not been changed return their results quickly and items
651 which have been changed compute their new result and cache it for future use.
653 The ``.git/tg-cache`` directory may be removed at any time and the cache will
654 simply be recreated in an on-demand fashion as needed, at some speed penalty,
655 until it's fully rebuilt.
657 To force the cache to be fully pre-loaded, run the ``tg summary`` command
658 without any arguments.  Otherwise, normal day-to-day TopGit operations should
659 keep it more-or-less up-to-date.
661 While each TopGit command is running, it uses a temporary subdirectory also
662 located in the ``.git`` directory.  These directories are named
663 ``tg-tmp.XXXXXX`` where the ``XXXXXX`` part will be random letters and digits.
665 These temporary directories should always be removed automatically after each
666 TopGit command finishes running.  As long as you are not in a subshell as a
667 result of a TopGit command stopping and waiting for a manual merge resolution,
668 it's safe to remove any of these directories that may have somehow accidentally
669 been left behind as a result of some failure that occurred while running a
670 TopGit command (provided, of course, it's not actually being used by a TopGit
671 command currently running in another terminal window or by another user on the
672 same repository).
675 USAGE
676 -----
677 ``tg [global options] <subcommand> [<subcommand option/argument>...]``
679 Global options:
681         ``[-C <dir>]... [-r <remote> | -u] [-c <name>=<val>]... [--no-pager]``
683         -C <dir>        Change directory to <dir> before doing anything more
684         -r <remote>     Pretend ``topgit.remote`` is set to <remote>
685         -u              Pretend ``topgit.remote`` is not set
686         -c <name=val>   Pass config option to git, may be repeated
687         --no-pager      Disable use of any pager (by both TopGit and Git)
688         --top-bases     Show full ``top-bases`` ref prefix and exit
689         --exec-path     Show path to subcommand scripts location and exit
690         --help          Show brief usage help and exit (aka ``-h``)
692 The ``tg`` tool has several subcommands:
694         :`tg annihilate`_:  Mark a TopGit-controlled branch as defunct
695         :`tg base`_:        Show base commit for one or more TopGit branches
696         :`tg checkout`_:    Shortcut for git checkout with name matching
697         :`tg contains`_:    Which TopGit-controlled branch contains the commit
698         :`tg create`_:      Create a new TopGit-controlled branch
699         :`tg delete`_:      Delete a TopGit-controlled branch cleanly
700         :`tg depend`_:      Add a new dependency to a TopGit-controlled branch
701         :`tg export`_:      Export TopGit branch patches to files or a branch
702         :`tg files`_:       Show files changed by a TopGit branch
703         :`tg help`_:        Show TopGit help optionally using a browser
704         :`tg import`_:      Import commit(s) to separate TopGit branches
705         :`tg info`_:        Show status information about a TopGit branch
706         :`tg log`_:         Run git log limiting revisions to a TopGit branch
707         :`tg mail`_:        Shortcut for git send-email with ``tg patch`` output
708         :`tg migrate-bases`_: Transition top-bases to new location
709         :`tg next`_:        Show branches directly depending on a TopGit branch
710         :`tg patch`_:       Generate a patch file for a TopGit branch
711         :`tg prev`_:        Show non-annihilated TopGit dependencies for a branch
712         :`tg push`_:        Run git push on TopGit branch(es) and depedencies
713         :`tg rebase`_:      Auto continue git rebase if rerere resolves conflicts
714         :`tg remote`_:      Set up remote for fetching/pushing TopGit branches
715         :`tg revert`_:      Revert ref(s) to a state stored in a ``tg tag``
716         :`tg status`_:      Show current TopGit status (e.g. in-progress update)
717         :`tg summary`_:     Show various information about TopGit branches
718         :`tg tag`_:         Create tag that records current TopGit branch state
719         :`tg update`_:      Update TopGit branch(es) with respect to dependencies
721 tg help
722 ~~~~~~~
723         Our sophisticated integrated help facility.  Mostly duplicates
724         what is below::
726          # to list commands:
727          $ tg help
728          # to get help for a particular command:
729          $ tg help <command>
730          # to get help for a particular command in a browser window:
731          $ tg help -w <command>
732          # to get help on TopGit itself
733          $ tg help tg
734          # to get help on TopGit itself in a browser
735          $ tg help -w tg
737 tg status
738 ~~~~~~~~~
739         Our sophisticated status facility.  Similar to Git's status command
740         but shows any in-progress update that's awaiting a merge resolution
741         or any other on-going TopGit activity (such as a branch creation).
743         With a single ``--verbose`` (or ``-v``) option include a short status
744         display for any dirty (but not untracked) files.  This also causes all
745         non file status lines to be prefixed with "## ".
747         With two (or more) ``--verbose`` (or ``-v``) options, additionally
748         show full symbolic ref names and unabbreviated hash values.
750         With the ``--exit-code`` option the exit code will be non-zero if any
751         TopGit or Git operation is currently in progress or the working
752         tree is unclean.
754 tg create
755 ~~~~~~~~~
756         Create a new TopGit-controlled topic branch of the given name
757         (required argument) and switch to it.  If no dependencies are
758         specified (by extra arguments passed after the first one), the
759         current branch is assumed to be the only dependency.
761         By default ``tg create`` opens an editor on the new ``.topmsg`` file
762         and then commits the new ``.topmsg`` and ``.topdeps`` files
763         automatically with a suitable default commit message.
765         The commit message can be changed with the ``-m`` (or ``--message``) or
766         ``-F`` (or ``--file``) option.  The automatic commit can be suppressed
767         by using the ``--no-ccmmit`` option.  Running the editor on the new
768         ``.topmsg`` file can be suppressed by using ``-n`` (or ``--no-edit``)
769         (which also suppresses the automatic commit) or by providing an
770         explicit value for the new ``.topmsg`` file using the ``--topmsg`` or
771         ``--topmsg-file`` option.  In any case the ``.topmsg`` content will be
772         automatically reformated to have a ``Subject:`` header line if needed.
774         If more than one dependency is listed, the automatic commit will not
775         take place until AFTER all the listed dependencies have been merged
776         into a base commit which will require some manual merge resolutions if
777         conflicts occur during the merge operations.
779         Previous versions of TopGit behaved as though the ``--no-edit`` option
780         was always given on the command line.
782         The default behavior has been changed to promote a separation between
783         commits that modify ``.topmsg`` and/or ``.topdeps`` and commits that
784         modify other files.  This facilitates cleaner cherry picking and other
785         patch maintenance activities.
787         You should edit the patch description (contained in the ``.topmsg``
788         file) as appropriate.  It will already contain some prefilled bits.
789         You can set the ``topgit.to``, ``topgit.cc`` and ``topgit.bcc``
790         git configuration variables (see ``man git-config``) in order to
791         have ``tg create`` add these headers with the given default values
792         to ``.topmsg`` before invoking the editor.
794         The main task of ``tg create`` is to set up the topic branch base
795         from the dependencies.  This may fail due to merge conflicts if more
796         than one dependency is given.   In that case, after you commit the
797         conflict resolution, you should call ``tg update --continue`` to
798         finish merging the dependencies into the new topic branch base.
800         With the ``--base`` (aka ``--no-deps``) option at most one dependency
801         may be listed which may be any valid committish (instead of just
802         refs/heads/...) and the newly created TopGit-controlled branch will
803         have an empty ``.topdeps`` file.  This may be desirable in order to
804         create a TopGit-controlled branch that has no changes of its own and
805         serves merely to mark the common dependency that all other
806         TopGit-controlled branches in some set of TopGit-controlled branches
807         depend on.  A plain, non-TopGit-controlled branch can be used for the
808         same purpose, but the advantage of a TopGit-controlled branch with no
809         dependencies is that it will be pushed with ``tg push``, it will show
810         up in the ``tg summary`` and ``tg info`` output with the subject from
811         its ``.topmsg`` file thereby documenting what it's for and finally it
812         can be set up with ``tg create -r`` and/or ``tg remote --populate`` to
813         facilitate sharing.
815         For example, ``tg create --base release v2.1`` will create a TopGit-
816         controlled ``release`` branch based off the ``v2.1`` tag that can then
817         be used as a base for creation of other TopGit-controlled branches.
818         Then when the time comes to move the base for an entire set of changes
819         up to ``v2.2`` the command ``tg update --base release v2.2`` can be
820         used followed by ``tg update --all``.
822         Using ``--base`` it's also possible to use ``tg create`` on an
823         unborn branch (omit the dependency name or specify ``HEAD``).  The
824         unborn branch itself can be made into the new TopGit branch (rather
825         than being born empty and then having the new TopGit branch based off
826         that) by specifying ``HEAD`` as the new branch's name (which is
827         probably what you normally want to do in this case anyway so you can
828         just run ``tg create --base HEAD`` to accomplish that).
830         In an alternative use case, if ``-r <branch>`` is given instead of a
831         dependency list, the topic branch is created based on the given
832         remote branch.  With just ``-r`` the remote branch name is assumed
833         to be the same as the local topic branch being created.  Since no
834         new commits are created in this mode (only two refs will be updated)
835         the editor will never be run for this use case.  Note that no other
836         options may be combined with ``-r``.
838         The ``--quiet`` (or ``-q``) option suppresses most informational
839         messages.
841 tg delete
842 ~~~~~~~~~
843         Remove a TopGit-controlled topic branch of the given name
844         (required argument). Normally, this command will remove only an
845         empty branch (base == head) without dependendents; use ``-f`` to
846         remove a non-empty branch or a branch that is depended upon by
847         another branch.
849         The ``-f`` option is also useful to force removal of a branch's
850         base, if you used ``git branch -D B`` to remove branch B, and then
851         certain TopGit commands complain, because the base of branch B
852         is still there.
854         Normally ``tg delete`` will refuse to delete the current branch.
855         However, giving ``-f`` twice (or more) will force it to do so but it
856         will first detach your HEAD.
858         IMPORTANT: Currently, this command will *NOT* remove the branch
859         from the dependency list in other branches. You need to take
860         care of this *manually*.  This is even more complicated in
861         combination with ``-f`` -- in that case, you need to manually
862         unmerge the removed branch's changes from the branches depending
863         on it.
865         See also ``tg annihilate``.
867         | TODO: ``-a`` to delete all empty branches, depfix, revert
869 tg annihilate
870 ~~~~~~~~~~~~~
871         Make a commit on the current TopGit-controlled topic branch
872         that makes it equal to its base, including the presence or
873         absence of .topmsg and .topdeps.  Annihilated branches are not
874         displayed by ``tg summary``, so they effectively get out of your
875         way.  However, the branch still exists, and ``tg push`` will
876         push it (except if given the ``-a`` option).  This way, you can
877         communicate that the branch is no longer wanted.
879         When annihilating a branch that has dependents (i.e. branches
880         that depend on it), those dependents have the dependencies of
881         the branch being annihilated added to them if they do not already
882         have them as dependencies.  Essentially the DAG is repaired to
883         skip over the annihilated branch.
885         Normally, this command will remove only an empty branch
886         (base == head, except for changes to the .top* files); use
887         ``-f`` to annihilate a non-empty branch.
889         After completing the annihilation itself, normally ``tg update``
890         is run on any modified dependents.  Use the ``--no-update`` option
891         to suppress running ``tg update``.
893 tg depend
894 ~~~~~~~~~
895         Change the dependencies of a TopGit-controlled topic branch.
896         This should have several subcommands, but only ``add`` is
897         supported right now.
899         The ``add`` subcommand takes an argument naming a topic branch to
900         be added, adds it to ``.topdeps``, performs a commit and then
901         updates your topic branch accordingly.  If you want to do other
902         things related to the dependency addition, like adjusting
903         ``.topmsg``, use the option ``--no-commit``.  Adding the
904         ``--no-update`` (or ``--no-commit``) option will suppress the
905         ``tg update`` normally performed after committing the change.
907         It is safe to run ``tg depend add`` in a dirty worktree, but the
908         normally performed ``tg update`` will be suppressed in that case
909         (even if neither ``--no-update`` nor ``--no-commit`` is given).
911         You have enabled ``git rerere`` haven't you?
913         | TODO: Subcommand for removing dependencies, obviously
915 tg files
916 ~~~~~~~~
917         List files changed by the current or specified topic branch.
919         Options:
920           -i            list files based on index instead of branch
921           -w            list files based on working tree instead of branch
923 tg info
924 ~~~~~~~
925         Show summary information about the current or specified topic
926         branch.
928         Numbers in parenthesis after a branch name such as "(11/3 commits)"
929         indicate how many commits on the branch (11) and how many of those
930         are non-merge commits (3).
932         With ``--verbose`` (or ``-v``) include a list of dependents (i.e. other
933         branches that depend on this one).  Another ``--verbose`` annotates
934         them with "[needs merge]" if the current tip of branch for which info
935         is being shown has not yet been merged into the base of the dependent.
937         Alternatively, if ``--heads`` is used then which of the independent
938         TopGit branch heads (as output by ``tg summary --topgit-heads``)
939         logically contains the specified commit (which may be any committish --
940         defaults to ``HEAD`` if not given).  Zero or more results will be
941         output.  Note that "logically" means with regard to the TopGit
942         dependency relationships as established by the ``.topdeps`` file(s).
943         It's the answer that would be given when all the TopGit branches are
944         up-to-date (even though they need not be to use this option) and the
945         ``git branch --contains`` command is run and the output then filtered
946         to only those branches that appear in ``tg summary --topgit-heads``.
947         This computation may require several seconds on complex repositories.
949         If ``--leaves`` is used then the unique list of leaves of the current
950         or specified topic branch is shown as one fully-qualified ref per line.
951         Duplicates are suppressed and a tag name will be used when appropriate.
952         A "leaf" is any dependency that is either not a TopGit branch or is
953         the base of a non-annihilated TopGit branch with no non-annihilated
954         dependencies.
956         The ``--deps`` option shows non-annihilated TopGit dependencies of the
957         specified branch (default is ``HEAD``).
959         The ``--dependents`` option shows non-annihilated TopGit dependents
960         (i.e. branches that depend on the specified branch).  The default
961         branch to operate on is again ``HEAD``.
963         A linearized patch series can only be automatically created for a
964         TopGit topic branch (including its recursive dependencies) when exactly
965         one line is output by ``tg info --leaves <topic-branch>``.
967         With ``--series`` the list of TopGit branches in the order they would
968         be linearized into a patch series is shown along with the description
969         of each branch.  If branch name passed to ``tg info`` is not the last
970         branch in the series a marker column will be provided to quickly
971         locate it in the list.  This same option can be used with `tg checkout`_.
973         Some patches shown in the list may not actually end up introducing any
974         changes if exported and be therefore end up being omitted.  The ``0``
975         indicator in ``tg summary`` output can help to identify some of these.
977         The patches shown in the series in the order they are shown form the
978         basis for the ``tg next`` and ``tg prev`` operations with the first
979         patch shown being considered the first and so on up to the last.
981 tg patch
982 ~~~~~~~~
983         Generate a patch from the current or specified topic branch.
984         This means that the diff between the topic branch base and head
985         (latest commit) is shown, appended to the description found in
986         the ``.topmsg`` file.
988         The patch is simply dumped to stdout.  In the future, ``tg patch``
989         will be able to automatically send the patches by mail or save
990         them to files. (TODO)
992         Options:
993           -i            base patch generation on index instead of branch
994           -w            base patch generation on working tree instead of branch
995           --binary      pass --binary to ``git diff-tree`` to enable generation
996                         of binary patches
997           --quiet       be quiet (aka ``-q``) about missing and unfixed From:
998           --from        make sure patch has a From: line, if not add one using
999           --from=<a>    <a> or Signed-off-by value or ident value; ``git am``
1000                         really gets unhappy with patches missing From: lines;
1001                         will NOT replace an existing non-empty From: header
1002           --no-from     leave all From: lines alone, missing or not (default)
1003           --diff-opt    options after the branch name (and an optional ``--``)
1004                         are passed directly to ``git diff-tree``
1006         In order to pass a sole explicit ``-w`` through to ``git diff-tree`` it
1007         must be separated from the ``tg`` options by an explicit ``--``.
1008         Or it can be spelled as ``--ignore-all-space`` to distinguuish it from
1009         ``tg``'s ``-w`` option.
1011         If the config variable ``topgit.from`` is set to a boolean it can be
1012         used to enable or disable the ``--from`` option by default.  If it's
1013         set to the speical value ``quiet`` the ``--quiet`` option is enabled
1014         and From: lines are left alone by default.  Any other non-empty value
1015         is taken as a default ``--from=<value>`` option.  The ``--no-from``
1016         option will temporarily disable use of the config value.
1018         If additional non-``tg`` options are passed through to
1019         ``git diff-tree`` (other than ``--binary`` which is fully supported)
1020         the resulting ``tg patch`` output may not be appliable.
1022 tg mail
1023 ~~~~~~~
1024         Send a patch from the current or specified topic branch as
1025         email(s).
1027         Takes the patch given on the command line and emails it out.
1028         Destination addresses such as To, Cc and Bcc are taken from the
1029         patch header.
1031         Since it actually boils down to ``git send-email``, please refer
1032         to the documentation for that for details on how to setup email
1033         for git.  You can pass arbitrary options to this command through
1034         the ``-s`` parameter, but you must double-quote everything.  The
1035         ``-r`` parameter with a msgid can be used to generate in-reply-to
1036         and reference headers to an earlier mail.
1038         WARNING: be careful when using this command.  It easily sends
1039         out several mails.  You might want to run::
1041                 git config sendemail.confirm always
1043         to let ``git send-email`` ask for confirmation before sending any
1044         mail.
1046         Options:
1047           -i            base patch generation on index instead of branch
1048           -w            base patch generation on working tree instead of branch
1050         | TODO: ``tg mail patchfile`` to mail an already exported patch
1051         | TODO: mailing patch series
1052         | TODO: specifying additional options and addresses on command line
1054 tg remote
1055 ~~~~~~~~~
1056         Register the given remote as TopGit-controlled. This will create
1057         the namespace for the remote branch bases and teach ``git fetch``
1058         to operate on them. However, from TopGit 0.8 onwards you need to
1059         use ``tg push``, or ``git push --mirror``, for pushing
1060         TopGit-controlled branches.
1062         ``tg remote`` takes an optional remote name argument, and an
1063         optional ``--populate`` switch.  Use ``--populate`` for your
1064         origin-style remotes: it will seed the local topic branch system
1065         based on the remote topic branches.  ``--populate`` will also make
1066         ``tg remote`` automatically fetch the remote, and ``tg update`` look
1067         at branches of this remote for updates by default.
1069         Using ``--populate`` with a remote name causes the ``topgit.remote``
1070         git configuration variable to be set to the given remote name.
1072 tg summary
1073 ~~~~~~~~~~
1074         Show overview of all TopGit-tracked topic branches and their
1075         up-to-date status.  With a branch name limit output to that branch.
1076         Using ``--deps-only`` or ``--rdeps`` changes the default from all
1077         related branches to just the current ``HEAD`` branch but using
1078         ``--all`` as the branch name will show results for all branches
1079         instead of ``HEAD``.
1081                 ``>``
1082                         marks the current topic branch
1084                 ``0``
1085                         indicates that it introduces no changes of its own
1087                 ``l``/``r``
1088                         indicates respectively whether it is local-only
1089                         or has a remote mate
1091                 ``L``/``R``
1092                         indicates respectively if it is ahead or out-of-date
1093                         with respect to its remote mate
1095                 ``D``
1096                         indicates that it is out-of-date with respect to its
1097                         dependencies
1099                 ``!``
1100                         indicates that it has missing dependencies [even if
1101                         they are recursive ones]
1103                 ``B``
1104                         indicates that it is out-of-date with respect to
1105                         its base
1107                 ``*``
1108                         indicates it is ahead of (and needs to be merged into)
1109                         at least one of its dependents -- only computed when
1110                         showing all branches or using the (possibly implied)
1111                         ``--with-deps`` option.
1113         This can take a longish time to accurately determine all the
1114         relevant information about each branch; you can pass ``-t`` (or ``-l``
1115         or ``--list``) to get just a terse list of topic branch names quickly.
1116         Also adding ``--verbose`` (or ``-v``) includes the subjects too.
1118         If no options or arguments are passed, the default is not actually to
1119         show ``--all`` branches (that was the default once upon a time).
1120         Instead, the default is essentially ``--with-deps $(tg info --heads)``
1121         with a fallback to ``--all`` if ``tg info`` doesn't give up any heads.
1122         This usually provides a more intuitive result.  Explicitly using
1123         ``--all`` will always show all branches (related or not to ``HEAD``).
1125         Passing ``--heads`` shows independent topic branch names and when
1126         combined with ``--rdeps`` behaves as though ``--rdeps`` were run with
1127         the output of ``--heads``.
1129         The ``--heads-independent`` option works just like ``--heads`` except
1130         that it computes the heads using ``git merge-base --independent``
1131         rather than examining the TopGit ``.topdeps`` relationships.  If the
1132         TopGit branches are all up-to-date (as shown in ``tg summary``) then
1133         both ``--heads`` and ``--heads-independent`` should compute the same
1134         list of heads (unless some overlapping TopGit branches have been
1135         manually created).  If not all the TopGit branches are up-to-date then
1136         the ``--heads-independent`` results may have extra items in it, but
1137         occasionally that's what's needed; usually it's the wrong answer.
1138         (Note that ``--topgit-heads`` is accepted as an alias for ``--heads``
1139         as well.)
1141         Using ``--heads-only`` behaves as though the output of ``--heads`` was
1142         passed as the list of branches along with ``--without-deps``.
1144         Alternatively, you can pass ``--graphviz`` to get a dot-suitable output
1145         for drawing a dependency graph between the topic branches.
1147         You can also use the ``--sort`` option to sort the branches using
1148         a topological sort.  This is especially useful if each
1149         TopGit-tracked topic branch depends on a single parent branch,
1150         since it will then print the branches in the dependency order.
1151         In more complex scenarios, a text graph view would be much more
1152         useful, but that has not yet been implemented.
1154         The ``--deps`` option outputs dependency information between
1155         branches in a machine-readable format.  Feed this to ``tsort`` to
1156         get the output from --sort.
1158         The ``--deps-only`` option outputs a sorted list of the unique branch
1159         names given on the command line plus all of their recursive
1160         dependencies (subject to ``--exclude`` of course).  When
1161         ``--deps-only`` is given the default is to just display information for
1162         ``HEAD``, but that can be changed by using ``--all`` as the branch
1163         name.  Each branch name will appear only once in the output no matter
1164         how many times it's visited while tracing the dependency graph or how
1165         many branch names are given on the command line to process.
1167         The ``--rdeps`` option outputs dependency information in an indented
1168         text format that clearly shows all the dependencies and their
1169         relationships to one another.  When ``--rdeps`` is given the default is
1170         to just display information for ``HEAD``, but that can be changed by
1171         using ``--all`` as the branch name or by adding the ``--heads`` option.
1172         Note that ``tg summary --rdeps --heads`` can be particularly helpful in
1173         seeing all the TopGit-controlled branches in the repository and their
1174         relationships to one another.
1176         Note that ``--rdeps`` has two flavors.  The first (and default) is
1177         ``--rdeps-once`` which only shows the dependencies of a branch when
1178         it's first visited.  For example, if D depends on several other
1179         branches perhaps recursively and both branch A and B depend on D, then
1180         whichever of A or B is shown first will show the entire dependency
1181         chain for D underneath it and the other one will just show a line for
1182         D itself.  This can make the output a bit more compact without actually
1183         losing any information which is why it's the default.  However, using
1184         the ``--rdeps-full`` variant will repeat the full dependency chain
1185         every time it's encountered.
1187         Adding ``--with-deps`` replaces the given list of branches (which will
1188         default to ``HEAD`` if none are given) with the result of running
1189         ``tg summary --deps-only --tgish`` on the list of branches.  This can
1190         be helpful in limiting ``tg summary`` output to only the list of given
1191         branches and their dependencies when many TopGit-controlled branches
1192         are present in the repository.  When it would be allowed,
1193         ``--with-deps`` is now the default.  Use ``--without-deps`` to switch
1194         back to the old behavior.
1196         With ``--exclude branch``, branch can be excluded from the output
1197         meaning it will be skipped and its name will be omitted from any
1198         dependency output.  The ``--exclude`` option may be repeated to omit
1199         more than one branch from the output.  Limiting the output to a single
1200         branch that has been excluded will result in no output at all.
1202         The ``--tgish-only`` option behaves as though any non-TopGit-controlled
1203         dependencies encountered during processing had been listed after an
1204         ``--exclude`` option.
1206         Note that the branch name can be specified as ``HEAD`` or ``@`` as a
1207         shortcut for the TopGit-controlled branch that ``HEAD`` is a
1208         symbolic ref to.  The ``tg summary @`` command can be quite useful.
1210         Options:
1211           -i            Use TopGit metadata from the index instead of the branch
1212           -w            Use TopGit metadata from the working tree instead of the branch
1214 tg contains
1215 ~~~~~~~~~~~
1216         Search all TopGit-controlled branches (and optionally their remotes)
1217         to find which TopGit-controlled branch contains the specified commit.
1219         This is more than just basic branch containment as provided for by the
1220         ``git branch --contains`` command.  While the shown branch name(s)
1221         will, indeed, be one (or more) of those output by the
1222         ``git branch --contains`` command, the result(s) will exclude any
1223         TopGit-controlled branches from the result(s) that have one (or more)
1224         of their TopGit dependencies (either direct or indirect) appearing in
1225         the ``git branch --contains`` output.
1227         Normally the result will be only the one, single TopGit-controlled
1228         branch for which the specified committish appears in the ``tg log``
1229         output for that branch (unless the committish lies outside the
1230         TopGit-controlled portion of the DAG and ``--no-strict`` was used).
1232         Unless ``--annihilated-okay`` (or ``--ann`` or ``--annihilated``) is
1233         used then annihilated branches will be immediately removed from the
1234         ``git branch --contains`` output before doing anything else.  This
1235         means a committish that was originally located in a now-annihilated
1236         branch will show up in whatever branch picked up the annihilated
1237         branch's changes (if there is one).  This is usually the correct
1238         answer, but occasionally it's not; hence this option.  If this option
1239         is used together with ``--verbose`` then annihilated branches will
1240         be shown as "[:annihilated:]".
1242         In other words, if a ``tg patch`` is generated for the found branch
1243         (assuming one was found and a subsequent commit in the same branch
1244         didn't then revert or otherwise back out the change), then that patch
1245         will include the changes introduced by the specified committish
1246         (unless, of course, that committish is outside the TopGit-controlled
1247         portion of the DAG and ``--no-strict`` was given).
1249         This can be very helpful when, for example, a bug is discovered and
1250         then after using ``git bisect`` (or some other tool) to find the
1251         offending commit it's time to commit the fix.  But because the
1252         TopGit merging history can be quite complicated and maybe the one
1253         doing the fix wasn't the bug's author (or the author's memory is just
1254         going), it can sometimes be rather tedious to figure out which
1255         TopGit branch the fix belongs in.  The ``tg contains`` command can
1256         quickly tell you the answer to that question.
1258         With the ``--remotes`` (or ``-r``) option a TopGit-controlled remote
1259         branch name may be reported as the result but only if there is no
1260         non-remote branch containing the committish (this can only happen
1261         if at least one of the TopGit-controlled local branches are not yet
1262         up-to-date with their remotes).
1264         With the ``--verbose`` option show which TopGit DAG head(s) (one or
1265         more of the TopGit-controlled branch names output by
1266         ``tg summary --heads``) have the result as a dependency (either direct
1267         or indirect).  Using this option will noticeably increase running time.
1269         With the default ``--strict`` option, results for which the base of the
1270         TopGit-controlled branch contains the committish will be suppressed.
1271         For example, if the committish was deep-down in the master branch
1272         history somewhere far outside of the TopGit-controlled portion of
1273         the DAG, with ``--no-strict``, whatever TopGit-controlled branch(es)
1274         first picked up history containing that committish will be shown.
1275         While this is a useful result it's usually not the desired result
1276         which is why it's not the default.
1278         To summarize, even with ``--remotes``, remote results are only shown
1279         if there are no non-remote results.  Without ``--no-strict`` (because
1280         ``--strict`` is the default) results outside the TopGit-controlled
1281         portion of the DAG are never shown and even with ``--no-strict`` they
1282         will only be shown if there are no ``--strict`` results.  Finally,
1283         the TopGit head info shown with ``--verbose`` only ever appears for
1284         local (i.e. not a remote branch) results.  Annihilated branches are
1285         never considered possible matches without ``--annihilated-okay``.
1287 tg checkout
1288 ~~~~~~~~~~~
1289         Switch to a topic branch.  You can use ``git checkout <branch>``
1290         to get the same effect, but this command helps you navigate
1291         the dependency graph, or allows you to match the topic branch
1292         name using a regular expression, so it can be more convenient.
1294         The ``--branch`` (or ``-b`` or ``--branch=<name>``) option changes
1295         the default starting point from ``HEAD`` to the specified branch.
1297         For the "next" and "previous" commands, the ``<steps>`` value may
1298         be ``--all`` (or ``-a``) to take "As nany steps As possible" or
1299         "step ALL the way" or "ALL steps at once" (or make something better
1300         up yourself).
1302         The following subcommands are available:
1304             ``tg checkout next [<steps>]``
1305                                 Check out a branch that directly
1306                                 depends on your current branch.
1307                                 Move ``<steps>`` (default 1) step(s) in
1308                                 the "next" direction (AKA ``n``).
1310             ``tg checkout prev [<steps>]``
1311                                 Check out a branch that this branch
1312                                 directly depends on.  Move ``<steps>``
1313                                 (default 1) step(s) in the "previous"
1314                                 direction (AKA ``p`` or ``previous``).
1316             ``tg checkout [goto] [--] <pattern>``
1317                                 Check out a topic branch that
1318                                 matches ``<pattern>``.  ``<pattern>``
1319                                 is used as a grep ERE pattern to filter
1320                                 all the topic branches.  Both ``goto`` and
1321                                 ``--`` may be omitted provided ``<pattern>``
1322                                 is not ``-a``, ``--all``, ``-h``, ``--help``,
1323                                 ``goto``, ``--``, ``n``, ``next``, ``push``,
1324                                 ``child``, ``p``, ``prev``, ``previous``,
1325                                 ``pop``, ``parent`` or ``..``.
1327             ``tg checkout [goto] [--] --series[=<head>]``
1328                                 Check out a topic branch that belongs to
1329                                 the current (or ``<head>``) patch series.
1330                                 A list with descriptions (``tg info --series``)
1331                                 will be shown to choose from if more than one.
1333             ``tg checkout push [<steps>]``
1334                                 An alias for ``next``.
1336             ``tg checkout child [<steps>]``
1337                                 Deprecated alias for ``next``.
1339             ``tg checkout``
1340                                 Semi-deprecated alias for ``next``.
1342             ``tg checkout pop [<steps>]``
1343                                 An alias for ``prev``.
1345             ``tg checkout parent [<steps>]``
1346                                 Deprecated alias for ``prev``.
1348             ``tg checkout .. [<steps>]``
1349                                 Semi-deprecated alias for ``prev``.
1351         If any of the above commands can find more than one possible
1352         branch to switch to, you will be presented with the matches
1353         and asked to select one of them.
1355         If the ``--ignore-other-worktrees`` (or ``--iow``) option is given and
1356         the current Git version is at least 2.5.0 then the full
1357         ``--ignore-other-worktrees`` option will be passed along to the
1358         ``git checkout`` command when it's run (otherwise the option will be
1359         silently ignored and not passed to Git as it would cause an error).
1361         The ``--force`` (or ``-f``) option, when given, gets passed through to
1362         the ``git checkout`` command.
1364         The ``<pattern>`` of ``tg checkout goto`` is optional.  If you don't
1365         supply it, all the available topic branches are listed and you
1366         can select one of them.
1368         Normally, the ``push`` and ``pop`` commands moves one step in
1369         the dependency graph of the topic branches.  The ``-a`` option
1370         causes them (and their aliases) to move as far as possible.
1371         That is, ``tg checkout push -a`` moves to a topic branch that
1372         depends (directly or indirectly) on the current branch and
1373         that no other branch depends on.  ``tg checkout pop -a``
1374         moves to a regular branch that the current topic branch
1375         depends on (directly or indirectly).  If there is more than
1376         one possibility, you will be prompted for your selection.
1378         See also NAVIGATION_.
1380 tg export
1381 ~~~~~~~~~
1382         Export a tidied-up history of the current topic branch and its
1383         dependencies, suitable for feeding upstream.  Each topic branch
1384         corresponds to a single commit or patch in the cleaned up
1385         history (corresponding basically exactly to ``tg patch`` output
1386         for the topic branch).
1388         The command has three possible outputs now -- either a Git branch
1389         with the collapsed history, a Git branch with a linearized
1390         history, or a quilt series in new directory.
1392         In the case where you are producing collapsed history in a new
1393         branch, you can use this collapsed structure either for
1394         providing a pull source for upstream, or for further
1395         linearization e.g. for creation of a quilt series using git log::
1397                 git log --pretty=email -p --topo-order origin..exported
1399         To better understand the function of ``tg export``, consider this
1400         dependency structure::
1402          origin/master - t/foo/blue - t/foo/red - master
1403                       `- t/bar/good <,----------'
1404                       `- t/baz      ------------'
1406         (where each of the branches may have a hefty history). Then::
1408          master$ tg export for-linus
1410         will create this commit structure on the branch ``for-linus``::
1412          origin/master - t/foo/blue -. merge - t/foo/red -.. merge - master
1413                       `- t/bar/good <,-------------------'/
1414                       `- t/baz      ---------------------'
1416         In this mode, ``tg export`` works on the current topic branch, and
1417         can be called either without an option (in that case,
1418         ``--collapse`` is assumed), or with the ``--collapse`` option, and
1419         with one mandatory argument: the name of the branch where the
1420         exported result will be stored.
1422         When using the linearize mode::
1424          master$ tg export --linearize for-linus
1426         you get a linear history respecting the dependencies of your
1427         patches in a new branch ``for-linus``.  The result should be more
1428         or less the same as using quilt mode and then reimporting it
1429         into a Git branch.  (More or less because the topological order
1430         can usually be extended in more than one way into a total order,
1431         and the two methods may choose different ones.)  The result
1432         might be more appropriate for merging upstream, as it contains
1433         fewer merges.
1435         Note that you might get conflicts during linearization because
1436         the patches are reordered to get a linear history.  If linearization
1437         would produce conflicts then using ``--quilt`` will also likely result
1438         in conflicts when the exported quilt series is applied.  Since the
1439         ``--quilt`` mode simply runs a series of ``tg patch`` commands to
1440         generate the patches in the exported quilt series and those patches
1441         will end up being applied linearly, the same conflicts that would be
1442         produced by the ``--linearize`` option will then occur at that time.
1444         To avoid conflicts produced by ``--linearize`` (or by applying the
1445         ``--quilt`` output), use the default ``--collapse`` mode and then use
1446         ``tg rebase`` (or ``git rebase -m`` directly) on the collapsed branch
1447         (with a suitable <upstream>) followed by ``git format-patch`` on the
1448         rebased result to produce a conflict-free patch set.  A suitable
1449         upstream may be determined with the ``tg info --leaves`` command (if
1450         it outputs more than one line, linearization will be problematic).
1452         You have enabled ``git rerere`` haven't you?
1454         When using the quilt mode::
1456          master$ tg export --quilt for-linus
1458         would create the following directory ``for-linus``::
1460          for-linus/t/foo/blue.diff
1461          for-linus/t/foo/red.diff
1462          for-linus/t/bar/good.diff
1463          for-linus/t/baz.diff
1464          for-linus/series:
1465                 t/foo/blue.diff -p1
1466                 t/bar/good.diff -p1
1467                 t/foo/red.diff -p1
1468                 t/baz.diff -p1
1470         With ``--quilt``, you can also pass the ``-b`` parameter followed
1471         by a comma-separated explicit list of branches to export, or
1472         the ``--all`` parameter (which can be shortened to ``-a``) to
1473         export them all.  The ``--binary`` option enables producing Git
1474         binary patches.  These options are currently only supported
1475         with ``--quilt``.
1477         In ``--quilt`` mode the patches are named like the originating
1478         topgit branch.  So usually they end up in subdirectories of the
1479         output directory.  With the ``--flatten`` option the names are
1480         mangled so that they end up directly in the output dir (slashes
1481         are replaced with underscores).  With the ``--strip[=N]`` option
1482         the first ``N`` subdirectories (all if no ``N`` is given) get
1483         stripped off.  Names are always ``--strip``'d before being
1484         ``--flatten``'d.  With the option ``--numbered`` (which implies
1485         ``--flatten``) the patch names get a number as prefix to allow
1486         getting the order without consulting the series file, which
1487         eases sending out the patches.
1489         | TODO: Make stripping of non-essential headers configurable
1490         | TODO: Make stripping of [PATCH] and other prefixes configurable
1491         | TODO: ``--mbox`` option to export instead as an mbox file
1492         | TODO: support ``--all`` option in other modes of operation
1493         | TODO: For quilt exporting, export the linearized history created in
1494                 a temporary branch--this would allow producing conflict-less
1495                 series
1497 tg import
1498 ~~~~~~~~~
1499         Import commits within the given revision range into TopGit,
1500         creating one topic branch per commit. The dependencies are set
1501         up to form a linear sequence starting on your current branch --
1502         or a branch specified by the ``-d`` parameter, if present.
1504         The branch names are auto-guessed from the commit messages and
1505         prefixed by ``t/`` by default; use ``-p <prefix>`` to specify an
1506         alternative prefix (even an empty one).
1508         Alternatively, you can use the ``-s NAME`` parameter to specify
1509         the name of the target branch; the command will then take one
1510         more argument describing a *single* commit to import.
1512 tg update
1513 ~~~~~~~~~
1514         Update the current, specified or all topic branches with respect
1515         to changes in the branches they depend on and remote branches.
1516         This is performed in two phases -- first, changes within the
1517         dependencies are merged to the base, then the base is merged
1518         into the topic branch.  The output will guide you on what to do
1519         next in case of conflicts.
1521         You have enabled ``git rerere`` haven't you?
1523         If you also enable the ``rerere.autoUpdate`` mode then ``tg update``
1524         will be able to automatically continue an update when ``git rerere``
1525         resolves all the conflicts and then stages the results in the index.
1526         This can be a big time saver.
1528         When ``-a`` (or ``--all``) is specifed, updates all topic branches
1529         matched by ``<pattern>``'s (see ``git-for-each-ref(1)`` for details),
1530         or all if no ``<pattern>`` is given.  Any topic branches with missing
1531         dependencies will be skipped entirely unless ``--skip-missing`` is
1532         specified.
1534         When ``--skip-missing`` is specifed, an attempt is made to update topic
1535         branches with missing dependencies by skipping only the dependencies
1536         that are missing.  Caveat utilitor.
1538         When ``--stash`` is specified (or the ``topgit.autostash`` config
1539         value is set to ``true``), a ref stash will be automatically created
1540         just before beginning updates if any are needed.  The ``--no-stash``
1541         option may be used to disable a ``topgit.autostash=true`` setting.
1542         See the ``tg tag`` ``--stash`` option for details.
1544         After the update, if a single topic branch was specified, it is
1545         left as the current one; if ``-a`` was specified, it returns to
1546         the branch which was current at the beginning.
1548         If your dependencies are not up-to-date, ``tg update`` will first
1549         recurse into them and update them.
1551         If a remote branch update brings in dependencies on branches
1552         that are not yet instantiated locally, you can either bring in
1553         all the new branches from the remote using ``tg remote
1554         --populate``, or only pick out the missing ones using ``tg create
1555         -r`` (``tg summary`` will point out branches with incomplete
1556         dependencies by showing an ``!`` next to them).  TopGit will attempt to
1557         instantiate just the missing ones automatically for you, if possible,
1558         when ``tg update`` merges in the new dependencies from the remote.
1560         Using the alternative ``--base`` mode, ``tg update`` will update
1561         the base of a specified ``[BASE]`` branch (which is a branch created
1562         by ``tg create`` using the ``--base`` option) to the specified
1563         committish (the second argument) and then immediately merge that into
1564         the branch itself using the specified message for the merge commit.
1565         If no message is specified on the command line, an editor will open.
1566         Unless ``--force`` is used the new value for the base must contain
1567         the old value (i.e. be a fast-forward update).  This is for safety.
1569         This mode makes updates to ``[BASE]`` branches quick and easy.
1571         | TODO: ``tg update -a -c`` to autoremove (clean) up-to-date branches
1573 tg push
1574 ~~~~~~~
1575         If ``-a`` or ``--all`` was specified, pushes all non-annihilated
1576         TopGit-controlled topic branches, to a remote repository.
1577         Otherwise, pushes the specified topic branches -- or the
1578         current branch, if you don't specify which.  By default, the
1579         remote gets all the dependencies (both TopGit-controlled and
1580         non-TopGit-controlled) and bases pushed to it too.  If
1581         ``--tgish-only`` was specified, only TopGit-controlled
1582         dependencies will be pushed, and if ``--no-deps`` was specified,
1583         no dependencies at all will be pushed.
1585         The ``--dry-run`` and ``--force`` options are passed directly to
1586         ``git push`` if given.
1588         The remote may be specified with the ``-r`` option. If no remote
1589         was specified, the configured default TopGit remote will be
1590         used.
1592 tg base
1593 ~~~~~~~
1594         Prints the base commit of each of the named topic branches, or
1595         the current branch if no branches are named.  Prints an error
1596         message and exits with exit code 1 if the named branch is not
1597         a TopGit branch.
1599 tg log
1600 ~~~~~~
1601         Prints the git log of the named topgit branch -- or the current
1602         branch, if you don't specify a name.
1604         This is really just a convenient shortcut for:
1606             ``git log --first-parent --no-merges $(tg base <name>)..<name>``
1608         where ``<name>`` is the name of the TopGit topic branch (or omitted
1609         for the current branch).
1611         However, if ``<name>`` is a ``[BASE]`` branch the ``--no-merges``
1612         option is omitted.
1614         If ``--compact`` is used then ``git log-compact`` will be used instead
1615         of ``git log``.  The ``--command=<git-alias>`` option can be used to
1616         replace "log" with any non-whitespace-containing command alias name,
1617         ``--compact`` is just a shortcut for ``--command=log-compact``.  The
1618         ``git-log-compact`` tool may be found on its project page located at:
1620             https://mackyle.github.io/git-log-compact
1622         Note that the ``--compact`` or ``--command=`` option must be used
1623         before any ``--`` or ``git log`` options to be recognized.
1625         NOTE: if you have merged changes from a different repository, this
1626         command might not list all interesting commits.
1628 tg tag
1629 ~~~~~~
1630         Creates a TopGit annotated/signed tag or lists the reflog of one.
1632         A TopGit annotated tag records the current state of one or more TopGit
1633         branches and their dependencies and may be used to revert to the tagged
1634         state at any point in the future.
1636         When reflogs are enabled (the default in a non-bare repository) and
1637         combined with the ``--force`` option a single tag name may be used as a
1638         sort of TopGit branch state stash.  The special branch name ``--all``
1639         may be used to tag the state of all current TopGit branches to
1640         facilitate this function and has the side-effect of suppressing the
1641         out-of-date check allowing out-of-date branches to be included.
1643         As a special feature, ``--stash`` may be used as the tag name in which
1644         case ``--all`` is implied if no branch name is listed (instead of the
1645         normal default of ``HEAD``), ``--force`` and ``--no-edit`` (use
1646         ``--edit`` to change that) are automatically activated and the tag will
1647         be saved to ``refs/tgstash`` instead of ``refs/tags/<tagname>``.
1648         The ``--stash`` tag name may also be used with the ``-g``/``--reflog``
1649         option.
1651         The mostly undocumented option ``--allow-outdated`` will bypass the
1652         out-of-date check and is implied when ``--stash`` or ``--all`` is used.
1654         A TopGit annotated/signed tag is simply a Git annotated/signed tag with
1655         a "TOPGIT REFS" section appended to the end of the tag message (and
1656         preceding the signature for signed tags).  PEM-style begin and end
1657         lines surround one line per ref where the format of each line is
1658         full-hash SP ref-name.  A line will be included for each branch given
1659         on the command line and each ref they depend on either directly or
1660         indirectly.
1662         If more than one TopGit branch is given on the command line, a new
1663         commit will be created that has an empty tree and all of the given
1664         TopGit branches as parents and that commit will be tagged.  If a single
1665         TopGit branch is given, then it will be tagged.  If the ``--tree``
1666         option is used then it will be used instead of an empty tree (a new
1667         commit will be created if necessary to guarantee the specified tree is
1668         what's in the commit the newly created tag refers to).  The argument to
1669         the ``--tree`` option may be any valid treeish.
1671         If exactly one of the branches to be tagged is prefixed with a tilde
1672         (``~``) it will be made the first parent of a consolidation commit if
1673         it is not already the sole commit needing to be tagged.  If ``--tree``
1674         is NOT used, its tree will also be used instead of the empty tree for
1675         any new consolidation commit if one is created.  Note that if
1676         ``--tree`` is given explicitly it's tree is always used but that does
1677         not in any way affect the choice of first parent.  Beware that the
1678         ``~`` may need to be quoted to prevent the shell from misinterpreting
1679         it into something else.
1681         All the options for creating a tag serve the same purpose as their Git
1682         equivalents except for two.  The ``--refs`` option suppresses tag
1683         creation entirely and emits the "TOPGIT REFS" section that would have
1684         been included with the tag.  If the ``--no-edit`` option is given and
1685         no message is supplied (via the ``-m`` or ``-F`` option) then the
1686         default message created by TopGit will be used without running the
1687         editor.
1689         With ``-g`` or ``--reflog`` show the reflog for a tag.  With the
1690         ``--reflog-message`` option the message from the reflog is shown.
1691         With the ``--commit-message`` option the first line of the tag's
1692         message (if the object is a tag) or the commit message (if the object
1693         is a commit) falling back to the reflog message for tree and blob
1694         objects is shown.  The default is ``--reflog-message`` unless the
1695         ``--stash`` (``refs/tgstash``) is being shown in which case the default
1696         is then ``--commit-message``.  Just add either option explicitly to
1697         override the default.
1699         When showing reflogs, non-tag entries are annotated with their type
1700         unless ``--no-type`` is given.
1702         TopGit tags are created with a reflog if core.logallrefupdates is
1703         enabled (the default for non-bare repositories).  Unfortunately Git
1704         is incapable of showing an annotated/signed tag's reflog
1705         (using git log -g) as it will first resolve the tag before checking to
1706         see if it has a reflog.  Git can, however, show reflogs for lightweight
1707         tags (using git log -g) just fine but that's not helpful here.  Use
1708         ``tg tag`` with the ``-g`` or ``--reflog`` option to see the reflog for
1709         an actual tag object.  This also works on non-TopGit annotated/signed
1710         tags as well provided they have a reflog.
1712         The number of entries shown may be limited with the ``-n`` option.  If
1713         the tagname is omitted then ``--stash`` is assumed.
1715         The ``--delete`` option is a convenience option that runs the
1716         ``git update-ref -d`` command on the specified tag removing it and its
1717         reflog (if it has one).
1719         The ``--clear`` option clears all but the most recent (the ``@{0}``)
1720         reflog entries from the reflog for the specified tag.  It's equivalent
1721         to dropping all the higher numbered reflog entries.
1723         The ``--drop`` option drops the specified reflog entry and requires the
1724         given tagname to have an ``@{n}`` suffix where ``n`` is the reflog
1725         entry number to be dropped.   This is really just a convenience option
1726         that runs the appropriate ``git reflog delete`` command.
1728         Note that when combined with ``tg revert``, a tag created by ``tg tag``
1729         can be used to transfer TopGit branches.  Simply create the tag, push
1730         it somewhere and then have the recipient run ``tg revert`` to recreate
1731         the TopGit branches.  This may be helpful in situations where it's not
1732         feasible to push all the refs corresponding to the TopGit-controlled
1733         branches and their top-bases.
1735 tg rebase
1736 ~~~~~~~~~
1737         Provides a ``git rebase`` rerere auto continue function.  It may be
1738         used as a drop-in replacement front-end for ``git rebase -m`` that
1739         automatically continues the rebase when ``git rerere`` information is
1740         sufficient to resolve all conflicts.
1742         You have enabled ``git rerere`` haven't you?
1744         If the ``-m`` or ``--merge`` option is not present then ``tg rebase``
1745         will complain and not do anything.
1747         When ``git rerere`` is enabled, previously resolved conflicts are
1748         remembered and can be automatically staged (see ``rerere.autoUpdate``).
1750         However, even with auto staging, ``git rebase`` still stops and
1751         requires an explicit ``git rebase --continue`` to keep going.
1753         In the case where ``git rebase -m`` is being used to flatten history
1754         (such as after a ``tg export --collapse`` prior to a
1755         ``git format-patch``), there's a good chance all conflicts have already
1756         been resolved during normal merge maintenance operations so there's no
1757         reason ``git rebase`` could not automatically continue, but there's no
1758         option to make it do so.
1760         The ``tg rebase`` command provides a ``git rebase --auto-continue``
1761         function.
1763         All the same rebase options can be used (they are simply passed through
1764         to Git unchanged).  However, the ``rerere.autoUpdate`` option is
1765         automatically temporarily enabled while running ``git rebase`` and
1766         should ``git rebase`` stop asking one to resolve and continue, but all
1767         conflicts have already been resolved and staged using rerere
1768         information, then ``git rebase --continue`` will be automatically run.
1770 tg revert
1771 ~~~~~~~~~
1772         Provides the ability to revert one or more TopGit branches and their
1773         dependencies to a previous state contained within a tag created using
1774         the ``tg tag`` command.  In addition to the actual revert mode
1775         operation a list mode operation is also provided to examine a tag's ref
1776         contents.
1778         The default mode (``-l`` or ``--list``) shows the state of one or more
1779         of the refs/branches stored in the tag data.  When no refs are given on
1780         the command line, all refs in the tag data are shown.  With the special
1781         ref name ``--heads`` then the indepedent heads contained in the tag
1782         data are shown.  The ``--deps`` option shows the specified refs and all
1783         of their dependencies in a single list with no duplicates.  The
1784         ``--rdeps`` option shows a display similar to ``tg summary --rdeps``
1785         for each ref or all TopGit heads if no ref is given on the command
1786         line.  The standard ``--no-short``, ``--short=n`` etc. options may be
1787         used to override the default ``--short`` output.  With ``--hash`` (or
1788         ``--hash-only``) show only the hash in ``--list`` mode in which case
1789         the default is ``--no-short``.   The ``--hash`` option can be used much
1790         like the ``git rev-parse --verify`` command to extract a specific hash
1791         value out of a TopGit tag.
1793         Note that unlike `tg summary`_, here ``--heads`` actually does mean the
1794         ``git merge-base --independent`` heads of the stored refs from the tag
1795         data.  To see only the independent TopGit topic branch heads stored in
1796         the tag data use the ``--topgit-heads`` option instead.  The default
1797         for the ``--rdeps`` option is ``--topgit-heads`` but ``--heads`` can
1798         be given explicitly to change that.  (Note that ``--heads-independent``
1799         is accepted as an alias for ``--heads`` as well.)
1801         The revert mode has three submodes, dry-run mode (``-n`` or
1802         ``--dry-run``), force mode (``-f`` or ``--force``) and interactive mode
1803         (``-i`` or ``--interactive``).  If ``--dry-run`` (or ``-n``) is given
1804         no ref updates will actually be performed but what would have been
1805         updated is shown instead.  If ``--interactive`` (or ``-i``) is given
1806         then the editor is invoked on an instruction sheet allowing manual
1807         selection of the refs to be updated before proceeding.  Since revert is
1808         potentially a destructive operation, at least one of the submodes must
1809         be specified explicitly.  If no refs are listed on the command line
1810         then all refs in the tag data are reverted.  Otherwise the listed refs
1811         and all of their dependencies (unless ``--no-deps`` is given) are
1812         reverted.  Unless ``--no-stash`` is given a new stash will be created
1813         using ``tg tag --stash`` (except, of course, in dry-run mode) just
1814         before actually performing the updates to facilitate recovery from
1815         accidents.
1817         Both modes accept fully-qualified (i.e. starts with ``refs/``) ref
1818         names as well as unqualified names (which will be assumed to be located
1819         under ``refs/heads/``).  In revert mode a tgish ref will always have
1820         both its ``refs/heads/`` and ``refs/top-bases/`` values included no
1821         matter how it's listed unless ``--no-deps`` is given and the ref is
1822         fully qualified (i.e. starts with ``refs/``) or one or the other of its
1823         values was removed from the instruction sheet in interactive mode.  In
1824         list mode a tgish ref will always have both its ``refs/heads/`` and
1825         ``refs/top-bases/`` values included only when using the ``--deps`` or
1826         ``--rdeps`` options.
1828         The ``--tgish-only`` option excludes non-tgish refs (i.e. refs that do
1829         not have a ``refs/heads/<name>``, ``refs/top-bases/<name>`` pair).
1831         The ``--exclude`` option (which can be repeated) excludes specific
1832         refs.  If the name given to ``--exclude`` is not fully-qualified (i.e.
1833         starts with ``refs/``) then it will exclude both members of a tgish ref
1834         pair.
1836         The ``--quiet`` (or ``-q``) option may be used in revert mode to
1837         suppress non-dry-run ref change status messages.
1839         The special tag name ``--stash`` (as well as with ``@{n}`` suffixes)
1840         can be used to refer to ``refs/tgstash``.
1842         The ``tg revert`` command supports tags of tags that contains TopGit
1843         refs.  So, for example, if you do this::
1845                 tg tag newtag --all
1846                 git tag -f -a -m "tag the tag" newtag newtag
1848         Then ``newtag`` will be a tag of a tag containing a ``TOPGIT REFS``
1849         section.  ``tg revert`` knows how to dereference the outermost
1850         tag to get to the next (and the next etc.) tag to find the
1851         ``TOPGIT REFS`` section so after the above sequence, the tag ``newtag``
1852         can still be used successfully with ``tg revert``.
1854         NOTE:  If HEAD points to a ref that is updated by a revert operation
1855         then NO WARNING whatsoever will be issued, but the index and working
1856         tree will always be left completely untouched (and the reflog for
1857         the pointed-to ref can always be used to find the previous value).
1859 tg prev
1860 ~~~~~~~
1861         Outputs the direct dependencies for the current or named branch.
1863         Options:
1864           -i            show dependencies based on index instead of branch
1865           -w            show dependencies based on working tree instead of branch
1867         See also NAVIGATION_.
1869 tg next
1870 ~~~~~~~
1871         Outputs all branches which directly depend on the current or
1872         named branch.
1874         Options:
1875           -i            show dependencies based on index instead of branch
1876           -w            show dependencies based on working tree instead of branch
1878         See also NAVIGATION_.
1880 tg migrate-bases
1881 ~~~~~~~~~~~~~~~~
1882         Transition top-bases from old location to new location.
1884         Beginning with TopGit release 0.19.4, TopGit has the ability to store
1885         the top-bases refs in either the old ``ref/top-bases/...`` location or
1886         the new ``refs/heads/{top-bases}/...`` location.  Starting with TopGit
1887         release 0.20.0, the default is the new location.
1889         By storing the top-bases under heads, Git is less likely to complain
1890         when manipulating them, hosting providers are more likely to provide
1891         access to them and Git prevents them from pointing at anything other
1892         than a commit object.  All in all a win for everyone.
1894         TopGit attempts to automatically detect whether the new or old location
1895         is being used for the top-bases and just do the right thing.  However,
1896         by explicitly setting the config value ``topgit.top-bases`` to either
1897         ``refs`` for the old location or ``heads`` for the new location the
1898         auto-detection can be bypassed.  If no top-bases refs are present in
1899         the repository the default prior to TopGit release 0.20.0 is to use the
1900         old location but starting with TopGit release 0.20.0 the default is to
1901         use the new location.
1903         The ``tg migrate-bases`` command may be used to migrate top-bases refs
1904         from the old location to the new location (or, by using the
1905         undocumented ``--reverse`` option, vice versa).
1907         With few exceptions (``tg create -r`` and ``tg revert``), all top-bases
1908         refs (both local *and* remote refs) are expected to be stored in the
1909         same location (either new or old).  A repository's current location for
1910         storing top-bases refs may be shown with the ``tg --top-bases`` command.
1912 TODO: tg rename
1913 ~~~~~~~~~~~~~~~
1915 IMPLEMENTATION
1916 --------------
1918 TopGit stores all the topic branches in the regular ``refs/heads/``
1919 namespace (so we recommend distinguishing them with the ``t/`` prefix).
1920 Apart from that, TopGit also maintains a set of auxiliary refs in
1921 ``refs/top-*``.  Currently, only ``refs/top-bases/`` is used, containing the
1922 current *base* of the given topic branch -- this is basically a merge of
1923 all the branches the topic branch depends on; it is updated during ``tg
1924 update`` and then merged to the topic branch, and it is the base of a
1925 patch generated from the topic branch by ``tg patch``.
1927 All the metadata is tracked within the source tree and history of the
1928 topic branch itself, in ``.top*`` files; these files are kept isolated
1929 within the topic branches during TopGit-controlled merges and are of
1930 course omitted during ``tg patch``.  The state of these files in base
1931 commits is undefined; look at them only in the topic branches
1932 themselves.  Currently, two files are defined:
1934         ``.topmsg``:
1935             Contains the description of the topic branch in a
1936             mail-like format, plus the author information, whatever
1937             Cc headers you choose or the post-three-dashes message.
1938             When mailing out your patch, basically only a few extra
1939             mail headers are inserted and then the patch itself is
1940             appended.  Thus, as your patches evolve, you can record
1941             nuances like whether the particular patch should have
1942             To-list / Cc-maintainer or vice-versa and similar
1943             nuances, if your project is into that.  ``From`` is
1944             prefilled from your current ``GIT_AUTHOR_IDENT``; other
1945             headers can be prefilled from various optional
1946             ``topgit.*`` git config options.
1948         ``.topdeps``:
1949             Contains the one-per-line list of branches this branch
1950             depends on, pre-seeded by ``tg create``. A (continuously
1951             updated) merge of these branches will be the *base* of
1952             your topic branch.
1954 IMPORTANT: DO NOT EDIT ``.topdeps`` MANUALLY!!! If you do so, you need to
1955 know exactly what you are doing, since this file must stay in sync with
1956 the Git history information, otherwise very bad things will happen.
1958 TopGit also automagically installs a bunch of custom commit-related
1959 hooks that will verify whether you are committing the ``.top*`` files in a
1960 sane state. It will add the hooks to separate files within the ``hooks/``
1961 subdirectory, and merely insert calls to them to the appropriate hooks
1962 and make them executable (but will make sure the original hook's code is
1963 not called if the hook was not executable beforehand).
1965 Another automagically installed piece is a ``.git/info/attributes``
1966 specifier for an ``ours`` merge strategy for the files ``.topmsg`` and
1967 ``.topdeps``, and the (intuitive) ``ours`` merge strategy definition in
1968 ``.git/config``.
1971 REMOTE HANDLING
1972 ---------------
1974 There are two remaining issues with accessing topic branches in remote
1975 repositories:
1977         (i) Referring to remote topic branches from your local repository
1978         (ii) Developing some of the remote topic branches locally
1980 There are two somewhat contradictory design considerations here:
1982         (a) Hacking on multiple independent TopGit remotes in a single
1983             repository
1984         (b) Having a self-contained topic system in local refs space
1986 To us, (a) does not appear to be very convincing, while (b) is quite
1987 desirable for ``git-log topic`` etc. working, and increased conceptual
1988 simplicity.
1990 Thus, we choose to instantiate all the topic branches of given remote
1991 locally; this is performed by ``tg remote --populate``. ``tg update``
1992 will also check if a branch can be updated from its corresponding remote
1993 branch.  The logic needs to be somewhat involved if we are to "do the
1994 right thing".  First, we update the base, handling the remote branch as
1995 if it was the first dependency; thus, conflict resolutions made in the
1996 remote branch will be carried over to our local base automagically.
1997 Then, the base is merged into the remote branch and the result is merged
1998 to the local branch -- again, to carry over remote conflict resolutions.
1999 In the future, this order might be adjustable on a per-update basis, in
2000 case local changes happen to be diverging more than the remote ones.
2001 (See the details in `The Update Process`_ for more in depth coverage.)
2003 All commands by default refer to the remote that ``tg remote --populate``
2004 was called on the last time (stored in the ``topgit.remote`` git
2005 configuration variable). You can manually run any command with a
2006 different base remote by passing ``-r REMOTE`` *before* the subcommand
2007 name or passing ``-u`` *before* the subcommand to run without one.
2010 TECHNICAL
2011 ---------
2013 A familiarity with the terms in the GLOSSARY_ is helpful for understanding the
2014 content of this sections.  See also the IMPLEMENTATION_ section.
2016 The Update Process
2017 ~~~~~~~~~~~~~~~~~~
2019 When a branch is "updated" using the ``tg update`` command the following steps
2020 are taken:
2022         1) The branch and all of its dependencies (and theirs recursively)
2023            are checked to see which ones are *out-of-date*.  See glossary_.
2025         2) Each of the branch's direct dependencies (i.e. they are listed in
2026            the branch's ``.topdeps`` file) which is out of date is updated
2027            before proceeding (yup, this is a recursive process).
2029         3) Each of the branch's direct dependencies (i.e. they are listed in
2030            the branch's ``.topdes`` file) that was updated in the previous
2031            step is now merged into the branch's corresponding base.  If a
2032            remote is involved, and the branch's corresponding base does NOT
2033            contain the remote branch's corresponding base that remote base is
2034            also merged into the branch's base at this time as well (it will be
2035            the first item merged into the branch's base).
2037         4) If the branch has a corresponding remote branch and the branch
2038            does not already contain it, it's merged into the branch's base
2039            (which was possibly already updated in step (3) to contain the
2040            remote branch's base but not the remote branch itself) on a detached
2041            HEAD.  Yup, this step can be a bit confusing and no, the updated
2042            base from step (3) has not yet been merged into the branch itself
2043            yet either.  If there is no remote branch this step does not apply.
2044            Using a detached HEAD allows the remote branch to be merged into the
2045            contents of the base without actually perturbing the base's ref.
2047         5) If there is a remote branch present then use the result of step (4)
2048            otherwise use the branch's base and merge that into the branch
2049            itself.
2051 That's it!  Simple, right? ;)
2053 Unless the auto stash option has been disabled (see `no undo`_, `tg update`_
2054 and `tg tag`_), a copy of all the old refs values will be stashed away
2055 immediately after step (1) before starting step (2), but only if anything is
2056 actually found to be out-of-date.
2058 Merge Strategies
2059 ~~~~~~~~~~~~~~~~
2061 The ``tg update`` command regularly performs merges while executing an update
2062 operation.  In order to speed things up, it attempts to do in-index merges
2063 where possible.  It accomplishes this by using a separate, temporary index
2064 file and the ``git read-tree -m --aggressive`` command possibly assisted by
2065 the ``git merge-index`` and ``git merge-file`` commands.  This combination may
2066 be repeated more than once to perform an octopus in-index merge.  If this
2067 fails, the files are checked out and a normal ``git merge`` three-way merge is
2068 performed (possily multiple times).  If the normal ``git merge`` fails then
2069 user intervention is required to resolve the merge conflict(s) and continue.
2071 Since the ``tg annihilate``, ``tg create`` and ``tg depend add`` commands may
2072 end up running the ``tg update`` machinery behind the scenes to complete their
2073 operation they may also result in any of these merge strategies being used.
2075 In addition to the normal Git merge strategies (if the in-index merging fails),
2076 there are four possible TopGit merge strategies that may be shown.  Since they
2077 all involve use of the ``git read-tree -m --aggressive`` command they are all
2078 variations of a "trivial aggressive" merge.  The "trivial" part because all of
2079 the merges done by ``git read-tree -m`` are described as "trivial" and the
2080 "aggressive" part because the ``--aggressive`` option is always used.
2082         1) "trivial aggressive"
2083                 Only two heads were involved and all merging was completed by
2084                 the ``git read-tree -m --aggressive`` command.
2086         2) "trivial aggressive automatic"
2087                 Only two heads were involved but after the
2088                 ``git read-tree -m --aggressive`` command completed there were
2089                 still unresolved items and ``git merge-index`` had to be run
2090                 (using the ``tg index-merge-one-file`` driver) which ultimately
2091                 ran ``git merge-file`` at least once to perform a simple
2092                 automatic three-way merge.  Hence the "automatic" description
2093                 and the "Auto-merging ..." output line(s).
2095         3) "trivial aggressive octopus"
2096                 This is the same as a "trivial aggressive" merge except that
2097                 more than two heads were involved and after merging the first
2098                 two heads, the ``git read-tree -m --aggressive`` step was
2099                 repeated again on the result for each additional head.  All
2100                 merging was completed via multiple
2101                 ``git read-tree -m --aggressive`` commands only.
2102                 This beast is relatively rare in the wild.
2104         4) "trivial aggressive automatic octopus"
2105                 This is very similar to the "trivial aggressive octopus"
2106                 except that at least one of the ``git read-tree -m --aggressive``
2107                 commands left unresolved items that were handled the same way
2108                 as the "trivial aggressive automatic" strategy.  This species
2109                 is commonly seen in the wild.
2112 GLOSSARY
2113 --------
2115         .topmsg
2116                 Version-controlled file stored at the root level of each
2117                 TopGit branch that contains the patch header for a TopGit
2118                 branch.  See also IMPLEMENTATION_;
2120         .topdeps
2121                 Version-controlled file stored at the root level of each
2122                 TopGit branch that lists the branch's dependencies one per
2123                 line omitting the leading ``refs/heads/`` part.  See also
2124                 IMPLEMENTATION_;
2126         branch containment
2127                 Given two Git commit identifiers (e.g. hashes) C1 and C2,
2128                 commit C1 "contains" commit C2 if either they are the same
2129                 commit or C2 can be reached from C1 by following one or more
2130                 parent links from C1 (perhaps via one or more intermediate
2131                 commits along the way).  In other words, if C1 contains C2
2132                 then C2 is an ancestor of C1 or conversely C1 is a descendant
2133                 of C2.  Since a TopGit branch name is also the name of a Git
2134                 branch (something located under the ``refs/heads`` Git
2135                 namespace) and similarly for a TopGit base, they can both be
2136                 resolved to a Git commit identifier and then participate in
2137                 a branch containment test.  An easy mnemonic for this is
2138                 "children contain the genes of their parents."
2140         BRE pattern
2141                 A Basic Regular Expression (BRE) pattern.  These are older
2142                 style regular expressions but have the advantage that all
2143                 characters other than ``\``, ``.``, ``*`` and ``[``
2144                 automatically match themselves without need for backslash
2145                 quoting (well actually, ``^`` and ``$`` are special at the
2146                 beginning and end respectively but otherwise match themselves).
2148         contains
2149                 See branch containment.
2151         ERE pattern
2152                 An Extended Regular Expression (ERE) pattern.  These are newer
2153                 style regular expressions where all the regular expression
2154                 "operator" characters "operate" when NOT preceded by a
2155                 backslash and are turned into normal characters with a ``\``.
2156                 The backreference atom, however, may not work, but ``?``, ``+``
2157                 and ``|`` "operators" do; unlike BREs.
2159         TopGit
2160                 Excellent system for managing a history of changes to one
2161                 or more possibly interrelated patches.
2163         TopGit branch
2164                 A Git branch that has an associated TopGit base.  Conceptually
2165                 it represents a single patch that is the difference between
2166                 the associated TopGit base and the TopGit branch.  In other
2167                 words ``git diff-tree <TopGit base> <TopGit branch>`` except
2168                 that any ``.topdeps`` and/or ``.topmsg`` files are excluded
2169                 from the result and the contents of the ``.topmsg`` file from
2170                 the TopGit branch is prefixed to the result.
2172         TopGit base
2173                 A Git branch that records the base upon which a TopGit branch's
2174                 single conceptual "patch" is built.  The name of the Git branch
2175                 is derived from the TopGit branch name by stripping off the
2176                 leading ``refs/heads/`` and appending the correct prefix where
2177                 all TopGit bases are stored (typically either
2178                 ``refs/top-bases/`` or ``refs/heads/{top-bases}/`` -- the
2179                 prefix for any given repository can be shown by using the
2180                 ``tg --top-bases`` command and updated using the
2181                 ``tg migrate-bases`` command).
2183                 All of a TopGit branch's dependencies are merged into the
2184                 corresponding TopGit base during a ``tg update`` of a branch.
2186         base
2187                 See TopGit base.
2189         TopGit ``[PATCH]`` branch
2190                 A TopGit branch whose subject starts with ``[PATCH]``.  By
2191                 convention these TopGit branches contain a single patch
2192                 (equivalent to a single patch file) and have at least one
2193                 dependency (i.e. their ``.topdeps`` files are never empty).
2195         TopGit ``[BASE]`` branch
2196                 A TopGit branch whose subject starts with ``[BASE]``.  By
2197                 convention these TopGit branches do not actually contain
2198                 any changes and their ``.topdeps`` files are empty.  They
2199                 are used to control a base dependency that another set of
2200                 branches depends on.
2202         TopGit ``[STAGE]`` branch
2203                 A TopGit branch whose subject starts with ``[STAGE]``.  By
2204                 convention these TopGit branches do not actually contain any
2205                 changes of their own but do have one or (typically) more
2206                 dependencies in their ``.topdeps`` file.  These branches are
2207                 used to bring together one or (typically) more independent
2208                 TopGit ``[PATCH]`` branches into a single branch so that
2209                 testing and/or evaluation can be performed on the result.
2211         merge conflict
2212                 When merging two (or more) heads that touch the same lines in
2213                 the file but in different ways the result is a merge conflict
2214                 that requires manual intervention.  If a merge conflict occurs
2215                 with more than two heads (an octopus merge) it's generally
2216                 replaced by multiple three-way merges so that by the time a
2217                 user sees a merge conflict needing manual resolution, there
2218                 will be only two heads involved.
2220         merge strategy
2221                 A Git merge strategy (see the "MERGE STRATEGIES" section of
2222                 ``git help merge``) or one of the TopGit `merge strategies`_
2223                 used to merge two or more heads.
2225         TopGit merge strategy
2226                 See the `Merge Strategies`_ section above for details but
2227                 basically these are just in-index merges done using the
2228                 ``git read-tree -m --aggressive`` command one or more times
2229                 possibily assisted by the ``git merge-index`` and the
2230                 ``git merge-file`` commands.
2232         next branch
2233                 In TopGit context the "next" branch refers to the branch that
2234                 corresponds to the next (aka following) patch in an ordered
2235                 (aka linearized) list of patches created by exporting the
2236                 TopGit branches in patch application order.
2238         octopus merge
2239                 A merge involving more than two heads.  Note that if there are
2240                 less than three independent heads the resulting merge that
2241                 started out as an octopus will end up not actually being an
2242                 octopus after all.
2244         out-of-date branch
2245                 A TopGit branch is considered to be "out-of-date" when ANY of
2246                 the following are true:
2248                         a) The TopGit branch does NOT contain its
2249                            corresponding base.
2251                         b) The TopGit branch does NOT contain its
2252                            corresponding remote branch (there may not be
2253                            a remote branch in which case this does not apply)
2255                         c) The TopGit branch's base does NOT contain its
2256                            corresponding remote branch's base (there may not be
2257                            a remote branch in which case this does not apply)
2259                         d) Any of the TopGit branches listed in the branch's
2260                            ``.topdeps`` file are NOT contained by the branch.
2261                            (See "branch containment" above.)
2263                         e) Any of the TopGit branches listed in the branch's
2264                            ``.topdeps`` file are out-of-date.
2266                 Note that if a remote branch is present and is NOT out-of-date
2267                 then it will contain its own base and (c) is mostly redundant.
2269         previous branch
2270                 In TopGit context the "previous" (or "prev") branch refers to
2271                 the branch that corresponds to the previous (aka preceding)
2272                 patch in an ordered (aka linearized) list of patches created by
2273                 exporting the TopGit branches in patch application order.
2275         remote TopGit branch
2276                 A Git branch with the same branch name as a TopGit branch
2277                 but living under ``refs/remotes/<some remote>/`` instead
2278                 of just ``refs/heads/``.
2280         remote TopGit base
2281                 The TopGit base branch corresponding to a remote TopGit branch,
2282                 which lives under ``refs/remotes/`` somewhere (depending on
2283                 what the output of ``tg --top-bases`` is for that remote).
2285         three-way merge
2286                 A three-way merge takes a common base and two heads (call them
2287                 A and B) and creates a new file that is the common base plus
2288                 all of the changes made between the common base and head A
2289                 *AND* all of the changes made between the common base and
2290                 head B.  The technique used to accomplish this is called a
2291                 "merge strategy".
2294 REFERENCES
2295 ----------
2297 The following references are useful to understand the development of
2298 topgit and its subcommands.
2300 * tg depend:
2301   http://public-inbox.org/git/36ca99e90904091034m4d4d31dct78acb333612e678@mail.gmail.com/T/#u
2304 THIRD-PARTY SOFTWARE
2305 --------------------
2307 The following software understands TopGit branches:
2309 * `magit <http://magit.github.io/>`_ -- a git mode for emacs
2311 IMPORTANT: Magit requires its topgit mode to be enabled first, as
2312 described in its documentation, in the "Activating extensions"
2313 subsection.  If this is not done, it will not push TopGit branches
2314 correctly, so it's important to enable it even if you plan to mostly use
2315 TopGit from the command line.