This test case creates a patch and then applies that patch to a modified source file. The source file is modified until the patch doesn't apply anymore, then the patch is fixed. $ rm -rf d $ mkdir -p d/patches $ cd d $ cat > one.txt < 1 < 2 < 3 < 4 < 5 < 6 < 7 < -- < a < b < c < d < e < f < g $ quilt new a.diff > Patch %{P}a.diff is now on top $ quilt add one.txt > File one.txt added to patch %{P}a.diff $ mv one.txt one.orig $ sed -e "s/4/4+/" -e 's/d/d+/' one.orig > one.txt $ quilt refresh > Refreshed patch %{P}a.diff $ quilt pop -q > Removing patch %{P}a.diff > No patches applied $ sed -e "s/^\\([17]\\)\$/\\1-/" one.orig > one.txt $ quilt push -q > Applying patch %{P}a.diff > Now at patch %{P}a.diff $ quilt pop -q > Removing patch %{P}a.diff > No patches applied $ sed -e "s/^\\([1267]\\)\$/\\1-/" one.orig > one.txt $ quilt push -q > Applying patch %{P}a.diff > Now at patch %{P}a.diff $ quilt pop -q > Removing patch %{P}a.diff > No patches applied $ sed -e "s/^\\([123567]\\)\$/\\1-/" one.orig > one.txt $ quilt push -q > Applying patch %{P}a.diff > 1 out of 2 hunks FAILED > Patch %{P}a.diff does not apply (enforce with -f) $ quilt push -qf > Applying patch %{P}a.diff >~ 1 out of 2 hunks FAILED -- saving rejects to (file )?`?one.txt.rej'? > Applied patch %{P}a.diff (forced; needs refresh) $ mv one.txt one.x $ sed -e "s/4/4+/" one.x > one.txt $ rm -f one.x $ quilt diff -z | grep -v "^\\(---\\|+++\\)" > Index: d/one.txt > =================================================================== > @@ -1,7 +1,7 @@ > 1- > 2- > 3- > -4 > +4+ > 5- > 6- > 7- $ quilt diff | grep -v "^\\(---\\|+++\\)" > Index: d/one.txt > =================================================================== > @@ -1,7 +1,7 @@ > 1- > 2- > 3- > -4 > +4+ > 5- > 6- > 7- > @@ -9,7 +9,7 @@ > a > b > c > -d > +d+ > e > f > g $ quilt refresh > Refreshed patch %{P}a.diff $ cat patches/a.diff | grep -v "^\\(---\\|+++\\)" > Index: d/one.txt > =================================================================== > @@ -1,7 +1,7 @@ > 1- > 2- > 3- > -4 > +4+ > 5- > 6- > 7- > @@ -9,7 +9,7 @@ > a > b > c > -d > +d+ > e > f > g $ quilt pop -q > Removing patch %{P}a.diff > No patches applied $ cd .. $ rm -rf d