Import a Quilt Series into Git with git quiltimport

Applying a stack of quilt patches by hand is tedious, and git quiltimport turns the whole series into proper Git commits in one pass. It keeps the patch order intact and creates one commit per patch. The examples use the locally installed Git 2.43.0 and a temporary repository, so you can test the workflow without risking a working project. Allow about fifteen minutes.

1. Check the installed command

Confirm the Git version before relying on details in a script. This is an ordinary, read-only check:

$ git --version
git version 2.43.0
$ git quiltimport -h
usage: git quiltimport [--dry-run] [--author <author>] [--patches <dir>]
                        [--series <file>] [--keep-non-patch]

The upstream manual documents the same interface through Git 2.55.0. The local manual says the command preserves patch boundaries, patch order and patch descriptions, which is exactly what you are trusting it to do.

2. Inspect the checkout and series

Import creates commits on the current branch, so confirm you are on the right one and that there are no unrelated edits first:

$ git branch --show-current
$ git status --short
$ sed -n '1,120p' patches/series
$ test -f patches/001-fix-timeout.patch && echo patch is present
patch is present

Swap in the real name from your series. If one is missing, stop and repair the input set, do not edit the Git branch to compensate for an incomplete series.

3. Understand the directory defaults

With no options, git quiltimport reads patches from patches and reads patches/series. The environment variables QUILT_PATCHES and QUILT_SERIES override those defaults, which is exactly the kind of thing a stale shell session forgets it set. Make the paths explicit when in doubt:

$ env -u QUILT_PATCHES -u QUILT_SERIES git quiltimport --patches patches --series patches/series --dry-run
001-fix-timeout.patch
002-add-test.patch

A dry run walks the patches and warns about missing information, especially author data. It does not create commits. The printed names are a useful checkpoint, not proof every resulting diff is correct.

4. Supply a safe author fallback

For each patch, Git tries to pull an author from the patch description. If a patch has none, --author supplies the fallback, use a real name and email belonging to the intended author, not automatically the person running the import:

$ git quiltimport --patches patches --series patches/series --author 'Patch Author <[email protected]>' --dry-run
001-fix-timeout.patch
002-add-test.patch

Tip: skip --author on a patch with no author metadata and Git will print the patch description and ask you to type one in interactively. Easy to miss inside automation, so provide the fallback deliberately or confirm every patch already carries usable metadata.

5. Import the series as commits

Warning: this changes the current branch by creating commits. Save the branch name and current commit first, so you have an exact recovery point:

$ git branch --show-current
topic-before-quiltimport
$ git rev-parse HEAD
4e3f... starting commit

Run the same command without --dry-run. Patches apply in series order, each becoming a separate Git commit:

$ git quiltimport --patches patches --series patches/series --author 'Patch Author <[email protected]>'
001-fix-timeout.patch
002-add-test.patch
$ git log --oneline --decorate -2
9ab... Add test
7cd... Fix timeout

Your hashes and subjects will differ. What should stay true: one new commit per patch, same order as series. When a patch description has no subject, the patch's file name becomes the one-line Git subject.

6. Verify authors, order and files

Check the resulting commits before pushing or merging them:

$ git log --format='%h %an <%ae> %s' --reverse HEAD~2..HEAD
7cd... Patch Author <[email protected]> Fix timeout
9ab... Another Author <[email protected]> Add test
$ git status --short
$ git diff HEAD~2 HEAD --stat

Use the actual number of imported patches, not the illustrative 2 above. A clean status means the files in the commits match the working tree. Inspect a suspicious patch with git show COMMIT before sharing the branch.

7. Recover from a failed import

If a patch does not apply, Git can stop part-way through the series. Do not guess your way past a conflict here. Record the error, inspect the status, and roll back to the commit you saved before the import:

$ git status
$ git log --oneline --decorate -5
$ git reset --hard STARTING_COMMIT

Warning: git reset --hard discards tracked working-tree changes. Only run it once you have confirmed STARTING_COMMIT is the saved pre-import commit and there is nothing else to preserve; if there were unrelated changes in flight, recover them first.

If the import completed but you decide not to keep it, reset to that same starting commit, or branch off the imported history before resetting. Do not push the imported branch until patch order, authors and diffs pass review.

8. Keep specialised options specialised

--keep-non-patch passes Git's -b option to git mailinfo. It matters when patch messages carry non-patch material that mailinfo would otherwise discard; leave it out for ordinary quilt patches and add it only after inspecting the patch format and confirming that content is wanted.

Keep the patch directory and series file unchanged during the import. Reordering or editing patches is a separate, reviewed change, followed by a repeated dry run. Avoid changing QUILT_PATCHES or QUILT_SERIES globally just to make one command work, an inherited value can quietly select a different patchset later.

Done means