title: Git: How does git remember the index for each branch?
body: <p>For example, I create file a in the repo(suppose I'm on the master branch),
  then I <code>git add a</code> and <code>git commit</code>.
  After that I <code>git branch copy</code> and <code>git checkout copy</code>.
  Finaly I create file b in the word directory then <code>git add b</code>.</p>
  
  <p>Git seems to be smart when I checkout back to the master branch, and <code>git ls-files</code>, file b is not listed.</p>
  
  <p>So I'm confused, since we only have one <code>index</code> file in a repo, how can git maintain different staging area for branches at the same time?</p>
  
  <p>EDIT:</p>
  
  <p>How to explain the files which are staged but not commited, is still remembered per branch?</p>