title: How to commit specific file in index?
body: <p>Example:</p>
  
  <pre><code>» git status
  On branch master
  Changes to be committed:
    (use "git reset HEAD &lt;file&gt;..." to unstage)
  
      modified:   a
      modified:   b
  
  Changes not staged for commit:
    (use "git add &lt;file&gt;..." to update what will be committed)
    (use "git checkout -- &lt;file&gt;..." to discard changes in working directory)
  
      modified:   a
  </code></pre>
  
  <p>If I have modified a file named a, and add parts of it to <code>index</code>, and there is a file named b  also in index.</p>
  
  <p>I want to commit only file a in index, neither include b nor a in work directory.</p>
  
  <p>The way I use is to use <code>git commit -p</code> and enter <code>n</code> to not stage. or <code>git commit -p file</code> and choose the part I want.</p>
  
  <p>But if the part in file a already add in index, is there a better way to direct commit file a only in index part?</p>
  
  <hr>
  
  <p>Supplement:</p>
  
  <p>I think maybe that is wrong use of git.</p>
  
  <blockquote>
    <p>Only the changes to be commited in the next commit, should add in the
    index.</p>
  </blockquote>
  
  <p>Obvious the file b is not prepared to be commited, so it thould in the working directory.</p>