title: git stash and edited hunks
body: <p>I totally love <code>git add -p</code> and <code>git stash</code> but I occasionally have the following problem, which is reproduced by the following sequence of commands:</p>
  
  <ul>
  <li><code>git add -p my_file</code>: then I <strong>edit a hunk manually</strong> (using <code>e</code>) because the splitting that git suggests does not suit me</li>
  <li><code>git stash --keep-index</code>: then I do some testing, and if the tests pass <em>I do not commit</em></li>
  <li><code>git stash pop</code>: now the problem occurs: the file <code>my_file</code> <strong>is now considered as conflicted</strong>, and git has completely messed with my edited hunk, so I have to edit the file, remove the useless merge marks, and run <code>git add my_file</code> followed by <code>git reset HEAD</code></li>
  </ul>
  
  <p>I'm puzzled because this happens only when editing a hunk manually. I don't see how this should make any difference at all.</p>
  
  <hr>
  
  <p>To reproduce the problem:</p>
  
  <ul>
  <li><code>touch newfile</code></li>
  <li><code>git add newfile</code></li>
  <li><code>git commit -m 'newfile'</code></li>
  <li>add two lines in the file</li>
  <li><code>git add -p newfile</code></li>
  <li>edit the hunk (<code>e</code>), remove one of the line in the hunk, then quit git add (<code>q</code>)</li>
  <li><code>git stash --keep-index</code></li>
  <li><code>git stash pop</code></li>
  </ul>
  
  <p>Now the file <code>newfile</code> is in unmerged state. Note, again, that the problem <strong>only occurs with manually edited hunks</strong>. There is no problem whatsoever with the commands above if one does not edit any hunk manually.</p>
  
  <p>Incidentally, the preceding state of the file is in the third stage (<code>git show :3:newfile</code>), and the previously staged version is in the second stage (<code>git show :2:newfile</code>). So I could, by some git black magic, manage to put the second stage in this index, and the third stage in the working repo... but I don't know how to do that so I do it by hand. :-(</p>