]> git.cworth.org Git - notmuch/blob - doc/man1/notmuch-git.rst
CLI/git: change defaults for repo and prefix
[notmuch] / doc / man1 / notmuch-git.rst
1 .. _notmuch-git(1):
2
3 ===========
4 notmuch-git
5 ===========
6
7 SYNOPSIS
8 ========
9
10 **notmuch** **git** [-h] [-N] [-C *repo*] [-p *prefix*] [-v] [-l *log level*] *subcommand*
11
12 **nmbug** [-h] [-C *repo*] [-p *prefix*] [-v] [-l *log level*] *subcommand*
13
14 DESCRIPTION
15 ===========
16
17 Manage notmuch tags with Git.
18
19 OPTIONS
20 -------
21
22 Supported options for `notmuch git` include
23
24 .. program:: notmuch-git
25
26 .. option::  -h, --help
27
28    show help message and exit
29
30 .. option:: -N, --nmbug
31
32    Set defaults for :option:`--tag-prefix` and :option:`--git-dir` suitable for the
33    :any:`notmuch` bug tracker
34
35 .. option:: -C <repo>, --git-dir <repo>
36
37    Operate on git repository *repo*. See :ref:`repo_location` for
38    defaults.
39
40 .. option:: -p <prefix>, --tag-prefix <prefix>
41
42    Operate only on tags with prefix *prefix*. See :ref:`prefix_val` for
43    defaults.
44
45 .. option::   -v, --version
46
47    show notmuch-git's version number and exit
48
49 .. option::   -l <level>, --log-level <level>
50
51    Log verbosity, one of: `critical`, `error`, `warning`, `info`,
52    `debug`. Defaults to `warning`.
53
54 SUBCOMMANDS
55 -----------
56
57 For help on a particular subcommand, run: 'notmuch-git ... <command> --help'.
58
59 .. program:: notmuch-git
60
61 .. option:: archive [tree-ish] [arg ...]
62
63 Dump a tar archive of a committed tag set using 'git archive'. See
64 :any:`format` for details of the archive contents.
65
66    .. describe:: tree-ish
67
68    The tree or commit to produce an archive for. Defaults to 'HEAD'.
69
70    .. describe:: arg
71
72    If present, any optional arguments are passed through to
73    :manpage:`git-archive(1)`. Arguments to `git-archive` are reordered
74    so that *tree-ish* comes last.
75
76 .. option:: checkout
77
78 Update the notmuch database from Git.
79
80 This is mainly useful to discard your changes in notmuch relative
81 to Git.
82
83 .. option:: clone <repository>
84
85 Create a local `notmuch git` repository from a remote source.
86
87 This wraps 'git clone', adding some options to avoid creating a
88 working tree while preserving remote-tracking branches and
89 upstreams.
90
91     .. describe:: repository
92
93     The (possibly remote) repository to clone from. See the URLS
94     section of :manpage:`git-clone(1)` for more information on
95     specifying repositories.
96
97 .. option:: commit [message]
98
99 Commit prefix-matching tags from the notmuch database to Git.
100
101    .. describe:: message
102
103    Optional text for the commit message.
104
105 .. option:: fetch [remote]
106
107 Fetch changes from the remote repository.
108
109     .. describe:: remote
110
111     Override the default configured in `branch.<name>.remote` to fetch
112     from a particular remote repository (e.g. `origin`).
113
114 .. option:: help
115
116 Show brief help for an `notmuch git` command.
117
118 .. option:: init
119
120 Create an empty `notmuch git` repository.
121
122 This wraps 'git init' with a few extra steps to support subsequent
123 status and commit commands.
124
125 .. option:: log [arg ...]
126
127 A wrapper for 'git log'.
128
129    .. describe:: arg
130
131    Additional arguments are passed through to 'git log'.
132
133 After running `notmuch git fetch`, you can inspect the changes with
134
135 ::
136
137    $ notmuch git log HEAD..@{upstream}
138
139 .. option:: merge [reference]
140
141 Merge changes from 'reference' into HEAD and load the result into notmuch.
142
143    .. describe:: reference
144
145    Reference, usually other branch heads, to merge into our
146    branch. Defaults to `@{upstream}`.
147
148 .. option:: pull [repository] [refspec ...]
149
150 Pull (merge) remote repository changes to notmuch.
151
152 **pull** is equivalent to **fetch** followed by **merge**.  We use the
153 Git-configured repository for your current branch
154 (`branch.<name>.repository`, likely `origin`, and `branch.<name>.merge`,
155 likely `master` or `main`).
156
157    .. describe:: repository
158
159    The "remote" repository that is the source of the pull. This parameter
160    can be either a URL (see the section GIT URLS in :manpage:`git-pull(1)`) or the
161    name of a remote (see the section REMOTES in :manpage:`git-pull(1)`).
162
163    .. describe:: refspec
164
165    Refspec (usually a branch name) to fetch and merge. See the
166    *refspec* entry in the OPTIONS section of :manpage:`git-pull(1`) for
167    other possibilities.
168
169 .. option:: push [repository] [refspec]
170
171 Push the local `notmuch git` Git state to a remote repository.
172
173     .. describe::  repository
174
175     The "remote" repository that is the destination of the push. This
176     parameter can be either a URL (see the section GIT URLS in
177     :manpage:`git-push(1)`) or the name of a remote (see the section
178     REMOTES in :manpage:`git-push(1)`).
179
180     .. describe:: refspec
181
182     Refspec (usually a branch name) to push. See the *refspec* entry in the OPTIONS section of
183     :manpage:`git-push(1)` for other possibilities.
184
185 .. option:: status
186
187 Show pending updates in notmuch or git repo.
188
189 Prints lines of the form
190
191 |  ng Message-Id tag
192
193 where n is a single character representing notmuch database status
194
195    .. describe:: A
196
197    Tag is present in notmuch database, but not committed to nmbug
198    (equivalently, tag has been deleted in nmbug repo, e.g. by a
199    pull, but not restored to notmuch database).
200
201    .. describe:: D
202
203    Tag is present in nmbug repo, but not restored to notmuch
204    database (equivalently, tag has been deleted in notmuch).
205
206    .. describe:: U
207
208    Message is unknown (missing from local notmuch database).
209
210 The second character *g* (if present) represents a difference between
211 local and upstream branches. Typically `notmuch git fetch` needs to be
212 run to update this.
213
214    .. describe:: a
215
216    Tag is present in upstream, but not in the local Git branch.
217
218    .. describe:: d
219
220    Tag is present in local Git branch, but not upstream.
221
222 .. _format:
223
224 REPOSITORY CONTENTS
225 ===================
226
227 The tags are stored in the git repo (and exported) as a set of empty
228 files. For a message with Message-Id *id*, for each tag *tag*, there
229 is an empty file with path
230
231        tags/ `encode` (*id*) / `encode` (*tag*)
232
233 The encoding preserves alphanumerics, and the characters `+-_@=.,:`.
234 All other octets are replaced with `%` followed by a two digit hex
235 number.
236
237 .. _repo_location:
238
239 REPOSITORY LOCATION
240 ===================
241
242 :any:`notmuch-git` uses the first of the following with a non-empty
243 value to locate the git repository.
244
245 - Option :option:`--git-dir`.
246
247 - Environment variable :envvar:`NOTMUCH_GIT_DIR`.
248
249 - If invoked as `nmbug` or with the :option:`--nmbug` option,
250   :code:`$HOME/.nmbug`; otherwise
251   :code:`$XDG_DATA_HOME/notmuch/$NOTMUCH_PROFILE/git`.
252
253 .. _prefix_val:
254
255 PREFIX VALUE
256 ============
257
258 :any:`notmuch-git` uses the first of the following with a non-null
259 value to define the tag prefix.
260
261 - Option :option:`--tag-prefix`.
262
263 - Environment variable :envvar:`NOTMUCH_GIT_PREFIX`.
264
265 - If invoked as `nmbug` or with the :option:`--nmbug` option,
266   :code:`notmuch::`, otherwise the empty string.
267
268 ENVIRONMENT
269 ===========
270
271 Variable :envvar:`NOTMUCH_PROFILE` influences :ref:`repo_location`.
272 If it is unset, 'default' is assumed.
273
274 .. envvar:: NOTMUCH_GIT_DIR
275
276    Default location of git repository. Overriden by :option:`--git-dir`.
277
278 .. envvar:: NOTMUCH_GIT_PREFIX
279
280    Default tag prefix (filter). Overriden by :option:`--tag-prefix`.
281
282 SEE ALSO
283 ========
284
285 :any:`notmuch(1)`,
286 :any:`notmuch-dump(1)`,
287 :any:`notmuch-restore(1)`,
288 :any:`notmuch-tag(1)`