git-debrebase(1)
git-debrebase(1) β yeah bestie, section 1, the git-debrebase manual. Buckle up π
π NAME π
git-debrebase β a tool that maintains your series of Debian changes to upstream source. That's literally its whole job and it eats every time π
β¨ SYNOPSIS β¨
git-debrebase [<options...>] [-- <git-rebase options...>]
git-debrebase [<options...>] <operation> [<operation options...>
(and yes, that second line is missing its closing bracket in the original, we're keeping it exactly like that, no cap π«Ά)
πΈ QUICK REFERENCE πΈ
okay so here's most of the commands you will regularly need β like, the ones you'll actually be typing at 2am:
git debrebase -i # edit the patch queue
git debrebase conclude && git push # push to eg salsa
git debrebase conclude && dgit push-source # source-only upload
git debrebase new-upstream 1.2.3-1 [-i] # uses tag, eg "v1.2.3"
dpkg-buildpackage -uc -b # get test debs, at any time
git debrebase -iβ edit the patch queue, iconic behaviourgit debrebase conclude && git pushβ push to eg salsagit debrebase conclude && dgit push-sourceβ source-only uploadgit debrebase new-upstream 1.2.3-1 [-i]β uses tag, eg"v1.2.3"dpkg-buildpackage -uc -bβ get test debs, at any time. ANY time. the way that works π
Want to add patches, or edit the packaging? Bestie. Just make git commits. That's it. That's the whole vibe. π¦
Ignore anything that may appear in debian/patches. Like, pretend you didn't see it. Look away. π
Avoid using"git pull"and"git merge"without"--ff-only". Seriously, don't do it, that's how you get a mess π
When you're sharing branches, you should usually share a fast-forwarding branch β ie, use "git-debrebase conclude" (or "prepush") before pushing. Fast-forward branch = main character energy, no rewrites, no drama β¨
Heads up: git-debrebase has a special branch format, so go see "CONVERTING AN EXISTING PACKAGE" in dgit-maint-debrebase(7). It's not like other branches fr fr π«Ά
π GUIDE TO DOCUMENTATION π
This right here? This is the command line reference. The facts, the flags, the whole menu π
There's also a detailed workflow tutorial at dgit-maint-debrebase(7) β and yes, the "QUICK REFERENCE" above is based on that. So it's giving tutorial-meets-reference, best of both worlds π
For background, theory of operation, and definitions, see git-debrebase(5). That's where the lore lives π
Do not skip this part, ok? You should read this manpage in conjunction with"TERMINOLOGY"ingit-debrebase(5), which defines many important terms used here. Like, actually read it. Future you will be so grateful, I promise ππ
π PRINCIPAL OPERATIONS π
Okay bestie, this is the main character section. These are the commands you'll actually live in. Sit down, hydrate, let's go. π
β¨ git-debrebase (no subcommand, just vibes) β¨
git-debrebase [-- <git-rebase options...>]
git-debrebase [-i <further git-rebase options...>]
This one unstitches and launders your branch. (Peep the "UNSTITCHING AND LAUNDERING" section below for what that actually means, iykyk.)
Then, if you handed it any git-rebase options at all, it goes and edits the Debian delta queue via git-rebase, by literally running:
git rebase <git-rebase options> <breakwater-tip>
π¨ Do not pass a base branch argument. git-debrebase picks that for you, that's its whole thing. Also do not use--ontoor--fork-point. Just don't. π
Actually useful git-rebase options to reach for include -i and --autosquash.
If git-rebase stops for any reason, you can git-rebase --abort, --continue, or --skip, same as always. But heads up: if you abort the git-rebase, your branch will still have been laundered β it's just that everything in the rebase gets undone.
The git-rebase options have to either start with -i, or be preceded by --, so they don't get confused with git-debrebase's own options. One of those two, no exceptions. π
β οΈ Using plain git-rebase on a git-debrebase branch is hazardous, fr fr. Because git-rebase has a nasty tendency to start the rebase too far back in history and then drop important commits. Like, it will eat your commits. See "ILLEGAL OPERATIONS" in git-debrebase(5).
β¨ git-debrebase status β¨
Analyzes your current branch β both what's inside it and which refs matter to git-debrebase β and prints a human-readable summary. Cute, informative, slays. π
Want to look at a specific commit instead of whatever branch you're on? That's git-debrebase examine's job.
π Please, please, do not try to parse the output. It might get reformatted or reorganised in the future. If you need machine-readable stuff, use one of the "UNDERLYING AND SUPPLEMENTARY OPERATIONS" described below instead.
β¨ git-debrebase conclude β¨
Finishes a git-debrebase session: tidies up the branch and makes it fast forward again. So satisfying. β¨
Specifically: if the branch is unstitched, it launders and restitches it, making a brand new pseudomerge. Otherwise, it's an error β unless you gave it --noop-ok.
β¨ git-debrebase quick β¨
Unconditionally launders and restitches the branch, consuming any ffq-prev and making a new pseudomerge. No thoughts, head empty, just laundry. π§Ί
If the branch is already laundered and stitched, it does nothing. Chill.
β¨ git-debrebase prepush β¨
git-debrebase prepush [--prose=<for commit message>]
If the branch is unstitched, it stitches it, consuming ffq-prev.
This is a genuinely good command to run before pushing to a git server. π«Ά That said, consider using conclude instead, because that one launders the branch too.
β¨ git-debrebase stitch β¨
git-debrebase stitch [--prose=<for commit message>]
Stitches the branch, consuming ffq-prev.
If there's no ffq-prev, it's an error β unless you passed --noop-ok.
Consider using prepush or conclude instead, they're the glow-ups of this command. β
β¨ git-debrebase scrap β¨
Throws away all the work since the branch was last stitched. Rude, but sometimes necessary. It does this by resetting you to ffq-prev and discarding every last working tree change.
If you're in the middle of a git-rebase, it'll abort that too.
If there's nothing to scrap, it's an error β unless you passed --noop-ok.
β¨ git-debrebase new-upstream β¨
git-debrebase new-upstream <new-version> [<upstream-details>...] [--|-i <git-rebase options...>]
Rebases the delta queue onto a new upstream version. In detail, because bestie deserves the full story:
First, it checks that the proposed rebase actually makes sense:
- It's a snag unless the new upstream(s) are fast forward from the previous upstream(s) as found in the current breakwater anchor.
- And, for a multi-piece upstream (a multi-component upstream, in dpkg-source terminology), it's a snag if the pieces aren't in the same order, with the same names.
If all seems well, it unstitches and launders the branch.
Then, it generates β in a private working area β a new anchor merge commit, on top of the breakwater tip, and on top of that a commit that updates the version number in debian/changelog.
Finally, it starts a git-rebase of the delta queue onto these new commits.
That git-rebase might just complete successfully, or it might need your assistance, exactly like a normal git-rebase. π
If you git-rebase --abort, the whole new upstream operation is aborted β except for the laundering.
<new-version> may be a whole new Debian version, including revision, or just the upstream part, in which case -1 gets appended to make the new Debian version.
The <upstream-details> are, optionally, in this order:
<upstream-commit-ish>β The new upstream branch (or commit-ish). The default is to look for one of these tags:upstream/U U vU, using the algorithm documented in UPSTREAM TAG SELECTION ingit-deborig(1).
It's a snag if the upstream contains a debian/ directory. If you force it to proceed anyway, git-debrebase will disregard the upstream's debian/ and take (only) the packaging from the current breakwater.
<piece-name> <piece-upstream-commit-ish>β Specifies that this is a multi-piece upstream. May be repeated. π
When such a pair is specified, git-debrebase will first combine the pieces of the upstream together, and then use the result as the combined new upstream.
For each <piece-name>, the tree of the <piece-upstream-commit-ish> becomes the subdirectory <piece-name> in the combined new upstream (supplanting any subdirectory that might be there in the main upstream branch).
<piece-name> has a restricted syntax: it may contain only ASCII alphanumerics and hyphens.
The combined upstream is itself recorded as a commit, with each of the upstream pieces' commits as parents. The combined commit contains an annotation so that a future git-debrebase new-upstream operation can do the coherency checks described above. π
<git-rebase options>β These get passed to git rebase.
If the upstream rebase is being troublesome, -i may be helpful. As with plain git-debrebase, do not specify a base, or --onto, or --fork-point.
π‘ If you're planning to generate a.dsc, you'll also need to have β or generate β actual orig tarball(s), which must be identical to the rev-spec(s) passed to git-debrebase. git-debrebase does not concern itself with source packages, so it neither helps with this nor checks it.git-deborig(1),git-archive(1),dgit(1)andgbp-import-orig(1)may be able to help.
β¨ git-debrebase make-patches β¨
git-debrebase make-patches [--quiet-would-amend]
Generates patches in debian/patches/ representing the changes made to upstream files. π
It's not normally necessary to run this command explicitly. When uploading to Debian, dgit and git-debrebase will cooperate to regenerate patches as necessary. And when you're working with pure git remotes, the patches aren't needed at all.
Normally git-debrebase make-patches will require a laundered branch. (A laundered branch doesn't contain any patches.) But if there are already some patches made by git-debrebase make-patches, and all that's happened is that more changes to upstream files have been committed, running it again can add the missing patches. π«Ά
If the patches implied by the current branch are not a simple superset of those already in debian/patches, make-patches will fail with exit status 7, plus an error message. (That message can be suppressed with --quiet-would-amend.) If the problem is simply that the existing patches weren't made by git-debrebase, using dgit quilt-fixup instead should succeed.
If there are no (more) patches to make, it's an error β unless you passed --noop-ok.
β¨ git-debrebase convert-from-unapplied / git-debrebase convert-from-gbp β¨
git-debrebase convert-from-unapplied [<upstream-commit-ish>]
git-debrebase convert-from-gbp [<upstream-commit-ish>]
Converts any of the following into a git-debrebase interchange branch:
- a gbp patches-unapplied branch (but not a gbp
pqpatch-queue branch) - a patches-unapplied git packaging branch containing
debian/patches, as used with quilt - a git branch for a package which has no Debian delta β i.e. where upstream files have not been modified in Debian, so there are no patches
(These two commands operate identically and are simply aliases. Same energy, different name. π )
The conversion is done by generating a new anchor merge, converting any quilt patches as a delta queue, and dropping the patches from the tree.
The upstream commit-ish should correspond to the upstream branch or tag, if there is one. It's a snag if it's not an ancestor of HEAD, or if the history between the upstream and HEAD contains commits which make changes to upstream files. If it's not specified, the same algorithm is used as for git-debrebase new-upstream.
It's also a snag if the specified upstream has a debian/ subdirectory. This check exists to detect certain likely user errors β but if this situation is true and expected, forcing it is fine.
git-debrebase will try to look for the dgit archive view of the most recent release, and if it finds it, it will make a pseudomerge so that your new git-debrebase view is appropriately fast forward. β¨
The result is a well-formed git-debrebase interchange branch. The result is also fast-forward from the original branch. Best of both worlds, honestly.
It's a snag if the new branch looks like it will have diverged, just like for a laundering/unstitching call to git-debrebase; see "Establish the current branch's ffq-prev", below.
π Note that it is dangerous not to know whether you're dealing with a (gbp) patches-unapplied branch containing quilt patches, or a git-debrebase interchange branch. At worst, using the wrong tool for the branch format might result in a dropped patch queue! DROPPED. QUEUE. Be careful out there.
β¨ git-debrebase examine COMMITISH β¨
Analyzes the contents of COMMITISH and prints a human-readable summary. π
Same rule as git-debrebase status: please do not attempt to parse the output. Ever. π
π git-debrebase breakwater
Prints the breakwater tip commitid. And if your HEAD branch isn't fully laundered yet? It prints the tip of the so-far-laundered breakwater instead. Baby steps, bestie π
β git-debrebase anchor
Prints the breakwater anchor commitid. That's it. Iconic, minimal, no notes.
π git-debrebase analyse
Walks the history of the current branch β most recent commit first β all the way back until it hits the most recent anchor. For every commit it prints the commit object id, plus the commit type and info (aka the semantics in the git-debrebase model). It's giving β¨full ancestry receiptsβ¨.
π git-debrebase record-ffq-prev
Establishes the current branch's ffq-prev, exactly like we talk about in "UNSTITCHING AND LAUNDERING" π β but it does not launder the branch and it does not move HEAD.
It is an error if the ffq-prev could not be recorded. It is also an error if an ffq-prev has already been recorded β unless you passed --noop-ok. π
π¦ git-debrebase convert-to-gbp
Converts a laundered branch into a gbp patches-unapplied branch stuffed with quilt patches. Heads up though: the result is not fast forward from the interchange branch, and any ffq-prev gets deleted. π«
This one is provided mostly for the test suite and for unusual situations. It should only be used with care and with a proper understanding of the underlying theory, okay?? Like, read the theory first, bestie.
Be sure to not accidentally treat the result as a git-debrebase branch, or you will drop all the patches! π Genuinely. All of them.
π git-debrebase convert-from-dgit-view [<convert-options>] [upstream]
Converts any dgit-compatible git branch corresponding to a (possibly hypothetical) 3.0 quilt dsc source package into a git-debrebase-compatible branch. Glow-up complete β¨
This operation should not be used if the branch is already in git-debrebase form. Normally git-debrebase will refuse to continue in this case (or silently do nothing if the global --noop-ok option is used).
Some representation of the original upstream source code will be needed. If upstream is supplied, that must be a suitable upstream commit. By default, git-debrebase will look first for git tags (as for new-upstream), and then for orig tarballs, which it will ask dgit to process.
The upstream source must be exactly right and all the patches indebian/patchesmust be up to date. Applying the patches fromdebian/patchesto the upstream source must result in exactly your HEAD. No wiggle room, no vibes-based tolerance. Exact. π―
The output is laundered and stitched. The resulting history is not particularly pretty β especially if orig tarball(s) were imported to produce a synthetic upstream commit. She's functional, not photogenic, and that's fine π
The available convert-options are as follows. (These must come after convert-from-dgit-view.)
--[no-]diagnoseβ Print additional error messages to help diagnose failure to find an appropriate upstream.--no-diagnoseis the default.--build-products-dirβ Directory to look in for orig tarballs. The default is the git config optiondgit.default.build-products-dir, or failing that,"..". Passed on todgit, if git-debrebase invokes dgit.--[no-]origsβ Whether to try to look for or use any orig tarballs.--origsis the default.--[no-]tagsβ Whether to try to look for or use any upstream git tags.--tagsis the default.--always-convert-anywayβ Perform the conversion operation, producing unpleasant extra history, even if the branch seems to be in git-debrebase form already. This should not be done unless necessary, and it should not be necessary. π© (Read that twice.)
π« git-debrebase forget-was-ever-debrebase
Deletes the ffq-prev and debrebase-last refs associated with this branch β the refs that git-debrebase and dgit use to work out whether this branch is managed by git-debrebase, and what previous head may need to be stitched back in.
This can be useful if you were just playing with git-debrebase and have used git-reset --hard to go back to a commit before your experiments. Un-oops, basically π§
Do not use this if you expect to run git-debrebase on the branch again. That's a one-way door, bestie. πͺ
βοΈ OPTIONS βοΈ
This section documents the general options to git-debrebase (ie, the ones which immediately follow git-debrebase or git debrebase on the command line). Individual operations may have their own options, which are documented under each operation. Different font, same energy π
-f<snag-id>β Turns snag(s) with id<snag-id>into warnings.
Some troublesome things which git-debrebase encounters are snags. (The specific instances are discussed in the text for the relevant operation.)
When a snag is detected, a message is printed to stderr containing the snag id (in the form -f<snag-id>), along with some prose.
If snags are detected, git-debrebase does not continue, unless the relevant -f<snag-id> is specified, or --force is specified.
--forceβ Turns all snags into warnings. See the-f<snag-id>option.
Do not invokegit-debrebase --forcein scripts and aliases; instead, specify the particular-f<snag-id>for expected snags. Be precise, not feral. πΈ
--noop-okβ Suppresses the error in some situations where git-debrebase does nothing, because there is nothing to do.
The specific instances are discussed in the text for the relevant operation.
--anchor=<commit-ish>β Treats<commit-ish>as an anchor. This overrides the usual logic which automatically classifies commits as anchors, pseudomerges, delta queue commits, etc.
It also disables some coherency checks which depend on metadata extracted from its commit message, so it is a snag (-fanchor-treated) if <commit-ish> is the anchor for the previous upstream version in git-debrebase new-upstream operations. You have to check yourself that the new upstream is fast forward from the old one, and has the right components (as if applicable). That's on you, bestie π«΅
--dgit=<program>β Run<program>, instead ofdgitfromPATH, when invocation of dgit is necessary. This is provided mostly for the benefit of the test suite. π§ͺ-Dβ Requests (more) debugging. May be repeated. Spam it if you're lost, no shame π--experimental-merge-resolutionβ No-op option, still accepted for compatibilty.
In previous versions this enabled attempting to handle general merges, but that attempt is now made unconditonally.
π§Ό UNSTITCHING AND LAUNDERING π
Several operations unstitch and launder the branch first. In detail, this means:
1οΈβ£ Establish the current branch's ffq-prev
If ffq-prev is not yet recorded, git-debrebase checks that the current branch is ahead of relevant remote tracking branches. The relevant branches depend on the current branch (and its git configuration) and are as follows:
- The branch that git would merge from (
remote.<branch>.merge,remote.<branch>.remote); - The branch git would push to, if different (
remote.<branch>.pushRemoteetc.); - For local dgit suite branches, the corresponding tracking remote;
- If you are on
"master",remotes/dgit/dgit/sid.
The apparently relevant ref names to check are filtered through branch.<branch>.ffq-ffrefs, which is a semicolon-separated list of glob patterns, each optionally preceded by !; first match wins.
In each case it is a snag if the local HEAD is behind the checked remote, or if local HEAD has diverged from it. All the checks are done locally using the remote tracking refs: git-debrebase does not fetch anything from anywhere. Zero network, all vibes π¦
If these checks pass, or are forced, git-debrebase then records the current tip as ffq-prev.
2οΈβ£ Examine the branch
git-debrebase analyses the current HEAD's history to find the anchor in its breakwater, and the most recent breakwater tip. Just scoping things out π
3οΈβ£ Rewrite the commits into laundered form
Mixed debian+upstream commits are split into two commits each. Delta queue (upstream files) commits bubble to the top. Pseudomerges, and quilt patch additions, are dropped. π«§
This rewrite will always succeed, by construction. The result is the laundered branch β squeaky clean, glowing, fresh out the laundry β¨π
π SEE ALSO
git-debrebase(5), dgit-maint-debrebase(7), dgit(1), gitglossary(7)
and that's the whole page, bestie!! π this is the Debian Project / dgit+tag2upload team production of git-debrebase(1) β go forth and launder responsibly ππ¦πΈ
π¦ where this page comes from
- ubuntu stonking: git-debrebase 17.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms