3 git-debrebase - tool to maintain series of Debian changes to upstream source
7 git-debrebase [<options...>] [-- <git-rebase options...>]
8 git-debrebase [<options...>] <operation> [<operation options...>
10 =head1 QUICK REFERENCE
12 These are most of the commands you will regularly need:
14 git debrebase -i # edit the patch queue
15 git debrebase conclude && git push # push to eg salsa
16 git debrebase conclude && dgit push-source # source-only upload
17 git debrebase [-i] new-upstream 1.2.3-1 # uses tag, eg "v1.2.3"
18 dpkg-buildpackage -uc -b # get test debs, at any time
20 To add patches, or edit the packaging, just make git commits.
21 Ignore anything that may appear in debian/patches.
22 Avoid using "git pull" and "git merge" without "--ff-only".
24 git-debrebase has a special branch format, so see
25 "CONVERTING AN EXISTING PACKAGE" in L<dgit-maint-debrebase(7)>.
27 =head1 GUIDE TO DOCUMENTATION
29 This is the command line reference.
30 There is also a detailed workflow tutorial at
31 L<dgit-maint-debrebase(7)>
32 (on which the above "QUICK REFERENCE" is based).
33 For background, theory of operation,
34 and definitions see L<git-debrebase(5)>.
36 You should read this manpage in conjunction with
37 L<git-debrebase(5)/TERMINOLOGY>,
38 which defines many important terms used here.
40 =head1 PRINCIPAL OPERATIONS
44 =item git-debrebase [-- <git-rebase options...>]
46 =item git-debrebase [-i <further git-rebase options...>]
48 Unstitches and launders the branch.
49 (See L</UNSTITCHING AND LAUNDERING> below.)
51 Then, if any git-rebase options were supplied,
52 edits the Debian delta queue,
53 using git-rebase, by running
55 git rebase <git-rebase options> <breakwater-tip>
57 Do not pass a base branch argument:
58 git-debrebase will supply that.
59 Do not use --onto, or --fork-point.
60 Useful git-rebase options include -i and --autosquash.
62 If git-rebase stops for any reason,
63 you may git-rebase --abort, --continue, or --skip, as usual.
64 If you abort the git-rebase,
65 the branch will still have been laundered,
66 but everything in the rebase will be undone.
68 The options for git-rebase must either start with C<-i>,
69 or be prececded by C<-->,
70 to distinguish them from options for git-debrebase.
72 It is hazardous to use plain git-rebase on a git-debrebase branch,
73 because git-rebase has a tendency to start the rebase
74 too far back in history,
75 and then drop important commits.
76 See L<git-debrebase(5)/ILLEGAL OPERATIONS>
78 =item git-debrebase status
80 Analyses the current branch,
81 both in terms of its contents,
82 and the refs which are relevant to git-debrebase,
83 and prints a human-readable summary.
85 Please do not attempt to parse the output;
86 it may be reformatted or reorganised in the future.
88 use one of the L<UNDERLYING AND SUPPLEMENTARY OPERATIONS>
91 =item git-debrebase conclude
93 Finishes a git-debrebase session,
94 tidying up the branch and making it fast forward again.
96 Specifically: if the branch is unstitched,
97 launders and restitches it,
98 making a new pseudomerge.
99 Otherwise, it is an error,
102 =item git-debrebase quick
104 Unconditionally launders and restitches the branch,
105 consuming any ffq-prev
106 and making a new pseudomerge.
108 If the branch is already laundered and stitched, does nothing.
110 =item git-debrebase prepush [--prose=<for commit message>]
112 If the branch is unstitched,
116 This is a good command to run before pushing to a git server.
117 You should consider using B<conclude> instead,
118 because that launders the branch too.
120 =item git-debrebase stitch [--prose=<for commit message>]
125 If there is no ffq-prev, it is an error, unless --noop-ok.
127 You should consider using B<prepush> or B<conclude> instead.
129 =item git-debrebase scrap
131 Throws away all the work since the branch was last stitched.
132 This is done by rewinding you to ffq-prev.
134 If you are in the middle of a git-rebase, will abort that too.
136 =item git-debrebase new-upstream <new-version> [<upstream-details>...]
138 Rebases the delta queue
139 onto a new upstream version. In detail:
141 Firstly, checks that the proposed rebase seems to make sense:
142 It is a snag unless the new upstream(s)
143 are fast forward from the previous upstream(s)
144 as found in the current breakwater anchor.
145 And, in the case of a multi-piece upstream
146 (a multi-component upstream, in dpkg-source terminology),
147 if the pieces are not in the same order, with the same names.
149 If all seems well, unstitches and launders the branch.
153 (in a private working area)
154 a new anchor merge commit,
155 on top of the breakwater tip,
156 and on top of that a commit to
157 update the version number in debian/changelog.
161 of the delta queue onto these new commits.
163 That git-rebase may complete successfully,
164 or it may require your assistance,
165 just like a normal git-rebase.
167 If you git-rebase --abort,
168 the whole new upstream operation is aborted,
169 except for the laundering.
172 may be a whole new Debian version, including revision,
173 or just the upstream part,
174 in which case -1 will be appended
175 to make the new Debian version.
177 The <upstream-details> are, optionally, in order:
181 =item <upstream-commit-ish>
183 The new upstream branch (or commit-ish).
184 The default is to look for one of these tags, in this order:
186 where U is the new upstream version.
187 (This is the same algorithm as L<git-deborig(1)>.)
189 It is a snag if the upstream contains a debian/ directory;
190 if forced to proceed,
191 git-debrebase will disregard the upstream's debian/ and
192 take (only) the packaging from the current breakwater.
194 =item <piece-name> <piece-upstream-commit-ish>
196 Specifies that this is a multi-piece upstream.
199 When such a pair is specified,
200 git-debrebase will first combine the pieces of the upstream
202 and then use the result as the combined new upstream.
204 For each <piece-name>,
205 the tree of the <piece-upstream-commit-ish>
206 becomes the subdirectory <piece-name>
207 in the combined new upstream
208 (supplanting any subdirectory that might be there in
209 the main upstream branch).
211 <piece-name> has a restricted syntax:
212 it may contain only ASCII alphanumerics and hyphens.
214 The combined upstream is itself recorded as a commit,
215 with each of the upstream pieces' commits as parents.
216 The combined commit contains an annotation
217 to allow a future git-debrebase new upstream operation
218 to make the coherency checks described above.
220 =item <git-rebase options>
222 These will be passed to git rebase.
224 If the upstream rebase is troublesome, -i may be helpful.
225 As with plain git-debrebase,
226 do not specify a base, or --onto, or --fork-point.
230 If you are planning to generate a .dsc,
231 you will also need to have, or generate,
232 actual orig tarball(s),
233 which must be identical to the rev-spec(s)
234 passed to git-debrebase.
235 git-debrebase does not concern itself with source packages
236 so neither helps with this, nor checks it.
238 L<git-archive(1)>, L<dgit(1)> and
239 L<gbp-import-orig(1)> may be able to help.
241 =item git-debrebase make-patches [--quiet-would-amend]
243 Generate patches in debian/patches/
244 representing the changes made to upstream files.
246 It is not normally necessary to run this command explicitly.
247 When uploading to Debian,
248 dgit and git-debrebase
249 will cooperate to regenerate patches as necessary.
250 When working with pure git remotes,
251 the patches are not needed.
253 Normally git-debrebase make-patches will
254 require a laundered branch.
255 (A laundered branch does not contain any patches.)
256 But if there are already some patches made by
257 git-debrebase make-patches,
258 and all that has happened is that more
259 changes to upstream files have been committed,
260 running it again can add the missing patches.
262 If the patches implied by the current branch
263 are not a simple superset of those already in debian/patches,
264 make-patches will fail with exit status 7,
265 and an error message.
266 (The message can be suppressed with --quiet-would-amend.)
267 If the problem is simply that
268 the existing patches were not made by git-debrebase,
269 using dgit quilt-fixup instead should succeed.
271 =item git-debrebase convert-from-unapplied [<upstream-commit-ish>]
273 =item git-debrebase convert-from-gbp [<upstream-commit-ish>]
275 Converts any of the following into a git-debrebase interchange branch:
281 a gbp patches-unapplied branch (but not a gbp pq patch-queue branch)
285 a patches-unapplied git packaging branch containing debian/patches,
290 a git branch for a package which has no Debian delta -
291 ie where upstream files are have not been modified in Debian,
292 so there are no patches
296 (These two commands operate identically and are simply aliases.)
298 The conversion is done by generating a new anchor merge,
299 converting any quilt patches as a delta queue,
300 and dropping the patches from the tree.
302 The upstream commit-ish should correspond to
303 the upstream branch or tag, if there is one.
304 It is a snag if it is not an ancestor of HEAD,
305 or if the history between the upstream and HEAD
306 contains commits which make changes to upstream files.
307 If it is not specified,
308 the same algorithm is used as for git-debrebase new-upstream.
310 It is also a snag if the specified upstream
311 has a debian/ subdirectory.
312 This check exists to detect certain likely user errors,
313 but if this situation is true and expected,
316 git-debrebase will try to look for the dgit archive view
317 of the most recent release,
318 and if it finds it will make a pseduomerge so that
319 your new git-debrebase view is appropriately fast forward.
321 The result is a well-formed git-debrebase interchange branch.
322 The result is also fast-forward from the original branch.
324 It is a snag if the new branch looks like it will have diverged,
325 just as for a laundering/unstitching call to git-debrebase;
326 See L</Establish the current branch's ffq-prev>, below.
328 Note that it is dangerous not to know whether you are
329 dealing with a (gbp) patches-unapplied branch containing quilt patches,
330 or a git-debrebase interchange branch.
332 using the wrong tool for the branch format might result in
333 a dropped patch queue!
337 =head1 UNDERLYING AND SUPPLEMENTARY OPERATIONS
341 =item git-debrebase breakwater
343 Prints the breakwater tip commitid.
344 If your HEAD branch is not fully laundered,
345 prints the tip of the so-far-laundered breakwater.
347 =item git-debrebase anchor
349 Prints the breakwater anchor commitid.
351 =item git-debrebase analyse
353 Walks the history of the current branch,
354 most recent commit first,
355 back until the most recent anchor,
356 printing the commit object id,
357 and commit type and info
358 (ie the semantics in the git-debrebase model)
361 =item git-debrebase record-ffq-prev
363 Establishes the current branch's ffq-prev,
364 as discussed in L</UNSTITCHING AND LAUNDERING>,
365 but does not launder the branch or move HEAD.
367 It is an error if the ffq-prev could not be recorded.
368 It is also an error if an ffq-prev has already been recorded,
371 =item git-debrebase launder-v0
373 Launders the branch without recording anything in ffq-prev.
374 Then prints some information about the current branch.
375 Do not use this operation;
376 it will be withdrawn soon.
378 =item git-debrebase convert-to-gbp
380 Converts a laundered branch into a
381 gbp patches-unapplied branch containing quilt patches.
382 The result is not fast forward from the interchange branch,
383 and any ffq-prev is deleted.
385 This is provided mostly for the test suite
386 and for unusual situations.
387 It should only be used with care and
388 with a proper understanding of the underlying theory.
390 Be sure to not accidentally treat the result as
391 a git-debrebase branch,
392 or you will drop all the patches!
394 =item git-debrebase convert-from-dgit-view [<convert-options>] [upstream]
396 Converts any dgit-compatible git branch
397 corresponding to a (possibly hypothetical) 3.0 quilt dsc source package
398 into a git-debrebase-compatible branch.
400 This operation should not be used
401 if the branch is already in git-debrebase form.
402 Normally git-debrebase will refuse to continue in this case
403 (or silently do nothing if the global --noop-ok option is used).
405 Some representation of the original upstream source code will be needed.
406 If I<upstream> is supplied, that must be a suitable upstream commit.
408 git-debrebase will look first for git tags (as for new-upstream),
409 and then for orig tarballs which it will ask dgit to process.
411 The upstream source must be exactly right and
412 all the patches in debian/patches must be up to date.
413 Applying the patches from debian/patches to the upstream source
414 must result in exactly your HEAD.
416 The output is laundered and stitched.
417 The resulting history is not particularly pretty,
418 especially if orig tarball(s) were imported
419 to produce a synthetic upstream commit.
421 The available convert-options are as follows.
422 (These must come after convert-from-dgit-view.)
426 =item --[no-]diagnose
428 Print additional error messages to help diagnose
429 failure to find an appropriate upstream.
430 --no-diagnose is the default.
432 =item --build-products-dir
434 Directory to look in for orig tarballs.
435 The default is the git config option
436 dgit.default.build-products-dir
437 or failing that, C<..>.
438 Passed on to dgit, if git-debrebase invokes dgit.
442 Whether to try to look for or use any orig tarballs.
443 --origs is the default.
447 Whether to try to look for or use any upstream git tags.
448 --tags is the default.
450 =item --always-convert-anyway
452 Perform the conversion operation,
453 producing unpleasant extra history,
454 even if the branch seems to be in git-debrebase form already.
455 This should not be done unless necessary,
456 and it should not be necessary.
460 =item git-debrebase forget-was-ever-debrebase
462 Deletes the ffq-prev and debrebase-last refs
463 associated with this branch,
464 that git-debrebase and dgit use to determine
465 whether this branch is managed by git-debrebase,
466 and what previous head may need to be stitched back in.
468 This can be useful if you were just playing with git-debrebase,
469 and have used git-reset --hard to go back to a commit
470 before your experiments.
472 Do not use this if you expect to run git-debrebase on the branch again.
478 This section documents the general options
480 (ie, the ones which immediately follow
484 on the command line).
485 Individual operations may have their own options which are
486 docuented under each operation.
492 Turns snag(s) with id <snag-id> into warnings.
494 Some troublesome things which git-debrebase encounters
496 (The specific instances are discussed
497 in the text for the relevant operation.)
499 When a snag is detected,
500 a message is printed to stderr containing the snag id
501 (in the form C<-f<snag-idE<gt>>),
502 along with some prose.
504 If snags are detected, git-debrebase does not continue,
505 unless the relevant -f<snag-id> is specified,
506 or --force is specified.
510 Turns all snags into warnings.
511 See the -f<snag-id> option.
513 Do not invoke git-debrebase --force in scripts and aliases;
514 instead, specify the particular -f<snag-id> for expected snags.
518 Suppresses the error in
519 some situations where git-debrebase does nothing,
520 because there is nothing to do.
522 The specific instances are discussed
523 in the text for the relvant operation.
525 =item --anchor=<commit-ish>
527 Treats <commit-ish> as an anchor.
528 This overrides the usual logic which automatically classifies
529 commits as anchors, pseudomerges, delta queue commits, etc.
531 It also disables some coherency checks
532 which depend on metadata extracted from its commit message,
534 it is a snag if <commit-ish> is the anchor
535 for the previous upstream version in
536 git-debrebase new-upstream operations.
538 =item --dgit=<program>
540 Run <program>, instead of dgit from PATH,
541 when invocation of dgit is necessary.
542 This is provided mostly for the benefit of the test suite.
546 Requests (more) debugging. May be repeated.
548 =item --experimental-merge-resolution
550 Enable experimental code for handling general merges
551 (see L<git-debrebase(5)/General merges>).
553 This option may generate lossage of various kinds,
554 including misleading error messages,
555 references to nonexistent documentation, and
556 you being handed an incomprehensible pile of
557 multidimensional merge wreckage.
561 =head1 UNSTITCHING AND LAUNDERING
563 Several operations unstitch and launder the branch first.
564 In detail this means:
566 =head2 Establish the current branch's ffq-prev
568 If ffq-prev is not yet recorded,
569 git-debrebase checks that the current branch is ahead of relevant
570 remote tracking branches.
571 The relevant branches depend on
572 the current branch (and its
580 The branch that git would merge from
581 (remote.<branch>.merge, remote.<branch>.remote);
585 The branch git would push to, if different
586 (remote.<branch>.pushRemote etc.);
590 For local dgit suite branches,
591 the corresponding tracking remote;
595 If you are on C<master>,
596 remotes/dgit/dgit/sid.
600 The apparently relevant ref names to check are filtered through
601 branch.<branch>.ffq-ffrefs,
602 which is a semicolon-separated list of glob patterns,
603 each optionally preceded by !; first match wins.
605 In each case it is a snag if
606 the local HEAD is behind the checked remote,
607 or if local HEAD has diverged from it.
608 All the checks are done locally using the remote tracking refs:
609 git-debrebase does not fetch anything from anywhere.
611 If these checks pass,
613 git-debrebse then records the current tip as ffq-prev.
615 =head2 Examine the branch
618 analyses the current HEAD's history to find the anchor
620 and the most recent breakwater tip.
622 =head2 Rewrite the commits into laundered form
624 Mixed debian+upstream commits are split into two commits each.
625 Delta queue (upstream files) commits bubble to the top.
627 and quilt patch additions,
630 This rewrite will always succeed, by construction.
631 The result is the laundered branch.
636 dgit-maint-debrebase(7),