LinuxCommandLibrary

quilt

Manage numerous patches with ease

TLDR

Import an existing patch from a file

$ quilt import [path/to/filename.patch]
copy

Create a new patch
$ quilt new [filename.patch]
copy

Add a file to the current patch
$ quilt add [path/to/file]
copy

After editing the file, refresh the current patch with the changes
$ quilt refresh
copy

Apply all the patches in the series file
$ quilt push -a
copy

Remove all applied patches
$ quilt pop -a
copy

SYNOPSIS

quilt {command} [options]

PARAMETERS

add patch_file...
    Adds one or more files to the current patch.

create patch_name
    Creates a new patch with the given name.

delete patch_name
    Deletes the named patch.

files
    Lists the files managed by quilt.

header [-p N] patch_file
    Extracts the header from the specified patch, adjusting the path strip level with -p.

patches
    Lists all available patches.

pop [-a] [-f] [patch_name...]
    Removes (unapplies) one or more patches. -a unapplies all patches. -f forces unapplication.

push [-a] [-f] [patch_name...]
    Applies one or more patches. -a applies all patches. -f forces application.

refresh [-p N] [-f] [-u] [-i] [patch_file...]
    Refreshes a patch by comparing the current state to the original. Options control path stripping (-p), forcing (-f), unified diff format (-u), and ignoring timestamps (-i).

revert [-a] [file...]
    Reverts changes in specified files to their original state or reverts all modified files if -a option is specified.

top
    Displays the name of the topmost applied patch.

new patch_name
    Creates a new, empty patch.

DESCRIPTION

The `quilt` command is a powerful tool for managing a stack of patches, especially useful when working with software development and custom kernels. It allows you to apply, unapply, and modify patches on top of a base source code, providing a flexible environment for experimenting with changes without directly modifying the original files. `quilt` essentially creates a directory where patches are stored as individual files. You can then apply these patches sequentially, reverse their order, and even edit them. This makes it easy to track modifications and revert to specific versions. This tool is very helpful when you need to integrate local changes with an upstream project. By using quilt, developers can easily manage complex patch workflows, ensuring a clean and organized approach to development. It's often used in embedded systems development, kernel customization, and general software modification.

CAVEATS

Requires careful management of the .quilt directory. Improper handling of this directory can lead to data loss or corruption of patches. It's also important to understand patch file formats (e.g., unified diffs) to effectively use quilt.

WORKING WITH QUILT

To start working with `quilt`, initialize a directory for patches, for example: `mkdir patches; cd patches; quilt new my_first_patch`.
Then, add files which needed to be modified to patch using `quilt add file1 file2`.
Modify the files. Afterwards, refresh the patch using `quilt refresh`.
You can then apply, unapply (pop), and manage the patch stack as needed.
You can push and pop a specific patch with `quilt push patch_name` and `quilt pop patch_name`.

CONFIGURATION

Quilt's behavior is customizable through environment variables like `QUILT_PATCHES` (specifies the patch directory) and `QUILT_DIFF_OPTS` (defines diff options). These can be set to tailor quilt to specific project needs.

HISTORY

The `quilt` command was developed to provide a more robust and flexible alternative to older patch management tools. It gained popularity in situations where multiple patches needed to be applied and managed, especially in kernel development and embedded systems where customization is frequent. Its design focuses on allowing developers to easily move between patches, modify them, and keep track of their changes, addressing the limitations of simpler patch application methods.

SEE ALSO

patch(1), diff(1)

Copied to clipboard