Apply series of patches using specific patch number

428 Views Asked by At

I have set of patches, for e.g as below.

0001-first-commit.patch
0002-second-commit.patch
0003-third-commit.patch
0004-4th-commit.patch
0005-fifth-commit.patch

What is the best way to apply patches from given patch number up to end. I mean can we specify 'range' while applying patch using git am?

For example, I want to apply patch from 0003 up to 0005. What flag with git am should I use? Is there any other method?

1

There are 1 best solutions below

0
ElpieKay On BEST ANSWER

To apply 0003 to 0005,

git am 000[3-5]*.patch

To skip 0001 and 0004,

git am 000[!14]*.patch

For more complicated situations, you may need a small script like a loop.