title: git staging all files which should not be staged
body: <p>I was working on a vistual studio c/C++ project which was not under any version control, All the files were in a my-project directory, </p>
  
  <p>I thought it's time to put it under version control , I copied a .gitignore file my project folder and opened git bash navigated to project directory and did </p>
  
  <pre><code>  git init
    git add .
  </code></pre>
  
  <p>Assuming it would obey the .gitignore file. What happened is it has stage all of my files disregarding the .gitignore file so all files under debug folder , release folder obj files etc are all staged</p>
  
  <p>my .gitignore looks like this, template was taken from a wiki answer on stackoverflow about visual studio project git ignore template.</p>
  
  <p>Can you help how to unstage all the files and make them filtered through gitignore ??</p>
  
  <pre><code>#OS junk files
  [Tt]humbs.db
  *.DS_Store
  
  #Visual Studio files
  *.[Oo]bj
  *.user
  *.aps
  *.pch
  *.vspscc
  *.vssscc
  *_i.c
  *_p.c
  *.ncb
  *.suo
  *.tlb
  *.tlh
  *.bak
  *.[Cc]ache
  *.ilk
  *.log
  *.lib
  *.sbr
  *.sdf
  *.opensdf
  *.unsuccessfulbuild
  ipch/
  obj/
  [Bb]in
  [Dd]ebug*/
  [Rr]elease*/
  Ankh.NoLoad
  
  #MonoDevelop
  *.pidb
  *.userprefs
  
  #Tooling
  _ReSharper*/
  *.resharper
  [Tt]est[Rr]esult*
  *.sass-cache
  
  #Project files
  [Bb]uild/
  
  #Subversion files
  .svn
  
  # Office Temp Files
  ~$*
  
  #NuGet
  packages/
  
  #ncrunch
  *ncrunch*
  *crunch*.local.xml
  
  # visual studio database projects
  *.dbmdl
  
  #Test files
  *.testsettings
  </code></pre>