quilt
Manage numerous patches with ease
TLDR
Import an existing patch from a file
Create a new patch
Add a file to the current patch
After editing the file, refresh the current patch with the changes
Apply all the patches in the series file
Remove all applied patches
SYNOPSIS
quilt [global-options] <subcommand> [subcommand-options] [arguments]
PARAMETERS
new <patch>
Creates a new, empty patch file in the series and makes it the topmost patch.
add <file>...
Adds one or more files to the topmost patch, so changes to them will be recorded.
edit <file>...
Opens files for editing, marking them for inclusion in the current patch. Changes are recorded when 'refresh' is run.
diff [-p <num>]
Shows the differences currently recorded in the topmost patch, or between the current state and a specific patch.
refresh
Updates the topmost patch with changes made to the source tree since the patch was applied or last refreshed.
push [-f|-a|-q]
Applies the next patch(es) in the series onto the source tree. '-a' applies all remaining patches, '-f' forces application even with conflicts.
pop [-a|-q]
Unapplies the current patch(es) from the source tree, moving them off the applied stack. '-a' unapplies all currently applied patches.
top
Prints the name of the patch currently at the top of the applied stack.
patches
Lists all patches in the series, indicating which ones are currently applied.
series
Displays the full ordered list of all patches in the series, whether applied or not.
grep <pattern> <patch>...
Searches for a specified pattern within the contents of patches.
delete [-r] <patch>...
Deletes one or more patches from the series. '-r' also unapplies them if they are currently applied.
rename <old_patch> <new_patch>
Renames a patch in the series.
fold [-a]
Combines the current topmost patch with the next patch in the series into a single patch file.
DESCRIPTION
quilt is a powerful command-line tool designed to manage a stack of patches applied to source code. It allows developers to keep track of a series of changes independent of the main codebase, enabling them to easily apply, unapply, add, remove, and reorder patches. This is particularly useful in development workflows where multiple modifications need to be maintained on top of a stable or upstream version, such as in Linux kernel development or embedded systems.
quilt maintains a directory of patches and a patch control (PC) directory to track which patches are currently applied. Developers can create new patches, refresh existing ones with new changes, or inspect the differences introduced by individual patches. Its design facilitates iterative development and easy sharing of patch sets, making it a flexible alternative or complement to version control systems like Git for managing specific patch layers.
CAVEATS
quilt can have a steeper learning curve compared to simple patch utilities. It requires a specific directory structure for its operation (the `patches` directory and the hidden `.pc` directory) which must be managed correctly. While powerful for managing linear patch stacks, it is not a full-fledged version control system and lacks capabilities like branching or merging found in tools like Git. Mismanagement of its state can lead to difficulties in applying or unapplying patches, especially with merge conflicts.
PATCH MANAGEMENT DIRECTORIES
quilt relies on two main directories: `patches/` (by default), which stores all the individual patch files, and `.pc/` (patch control), a hidden directory where `quilt` stores its internal state, including the original files before patches were applied, allowing for easy unapplication and refresh operations.
ENVIRONMENT VARIABLES
quilt behavior can be influenced by environment variables like `QUILT_PATCHES` (to specify an alternative patch directory) and `QUILT_PC` (to specify an alternative patch control directory), allowing for flexible configuration and isolation of patch sets for different projects.
HISTORY
quilt was originally developed by Andrew Morton for managing the extensive patch set of the Linux kernel's development tree (the "mm" tree) before the kernel's full migration to Git. It provided a flexible way to organize and test numerous independent patches on top of the stable kernel. Although much of kernel development has since moved to Git's integrated patch management, quilt remains valuable for maintaining local patch sets on existing codebases, especially in environments where a full Git repository might be overkill or impractical, or for specific layering tasks.
SEE ALSO
patch(1), diff(1), git-am(1), git-format-patch(1)