I have a directory with .patch
files, generated using diff.
I would like to apply all those patches using patch -p1
to another directory.
But patch takes only one file, unless I cat
.
What would the command be to apply multiple files using xargs
or a similar tool.
Assuming you're using bash/sh/zsh etc...
Accepted answer did not work for me, it seems to assume patch can take multiple patch files on one command line. My solution:
Find: Finds patch files
Sort: Sorts patch files so order remains (e.g. 001 comes before 002)
xargs: Call patch using stdin as arguments
If
cat
works, why not use it?To use
find
andxargs
:Example:
This actually works (in Bash):
Debian uses a very nice tool called quilt for its package management.
On Debian/Ubuntu install it with
Take a look at this very nice tutorial from Shakthi Kannan: Quilt Tutorial, even it is a bit older.
To give an overview, take a look at the man page
quilt (1)
:To sum it up you can add patches to a file called series and manage it by several ways. You can add, remove patches, and get a list of applied patches, ...