Note that there are some explanatory texts on larger screens.

plurals
  1. POgit add --interactive "Your edited hunk does not apply"
    text
    copied!<p>I'm trying to use <code>git add --interactive</code> to selectively add some changes to my index, but I continually receive the "Your edited hunk does not apply. Edit again..." message. I get this message even if I choose the e option, and immediately save/close my editor. In other words, without editing the hunk at all, the patch doesn't apply.</p> <p>Here's the exact example I'm using (I'm trying to put together a small demo):</p> <p>Original file:</p> <pre><code>first change second change off branch third change off branch second change third change fourth change </code></pre> <p>New file:</p> <pre><code>Change supporting feature 1 first change second change off branch third change off branch second change third change fourth change bug fix 1 change supporting feature 1 </code></pre> <p>I'm trying to show how to use <code>git add --interactive</code> to only add the "bug fix 1" line to the index. Running interactive add on the file, I choose the patch mode. It presents me with </p> <pre><code>diff --git a/newfile b/newfile index 6d501a3..8b81ae9 100644 --- a/newfile +++ b/newfile @@ -1,6 +1,9 @@ +Change supporting feature 1 first change second change off branch third change off branch second change third change fourth change +bug fix 1 +change supporting feature 1 </code></pre> <p>I respond with split, followed by "no" to apply the first hunk. The second hunk, I try to edit. I originally tried deleting the bottom line - that didn't work. Leaving the hunk alone completely doesn't work either, and I can't figure out why.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload