title: git ls-files, how to escape spaces in files paths?
body: <p>A whole BUNCH of files got checked into our git repo before we introduced the .gitignore file.  I'm currently trying to clean it up with:  </p>
  
  <pre><code>git rm --cached `git ls-files -i --exclude-from=.gitignore`
  </code></pre>
  
  <p>The thing is MANY of the file paths have spaces in them.  </p>
  
  <p>For example:</p>
  
  <pre><code>......
  Assets/Aoi Character Pack/Viewer/Resources/Aoi/Viewer BackGrounds/bg12.png.meta
  Assets/Aoi Character Pack/Viewer/Resources/Aoi/Viewer BackGrounds/bg13.png.meta
  Assets/Aoi Character Pack/Viewer/Resources/Aoi/Viewer BackGrounds/bg14.png.meta
  Assets/Aoi Character Pack/Viewer/Resources/Aoi/Viewer BackGrounds/bg15.png.meta
  Assets/Aoi Character Pack/Viewer/Resources/Aoi/Viewer BackGrounds/bg16.png.meta
  Assets/Aoi Character Pack/Viewer/Resources/Aoi/Viewer BackGrounds/bg17.png.meta
  Assets/Aoi Character Pack/Viewer/Resources/Aoi/Viewer BackGrounds/bg18.png.meta
  .......
  </code></pre>
  
  <p>There's a WHOLE LOTTA SPACES in a whole lotta files that I need to get rid of.</p>
  
  <p>I'm looking for an elegant way of either:</p>
  
  <ul>
  <li><p>A: Escape the spaces with a "\",  for example</p>
  
  <p><code>Assets/Aoi\ Character Pack/Viewer/Resources/Aoi/Viewer\ BackGrounds/bg18.png.meta</code></p></li>
  </ul>
  
  <p>-or-</p>
  
  <ul>
  <li><p>B: Have <code>git ls-files</code> pump out my list of files all snuggled neatly in between quotes.</p>
  
  <p><code>'Assets/Aoi Character Pack/Viewer/Resources/Aoi/Viewer BackGrounds/bg18.png.meta'</code></p></li>
  </ul>
  
  <p>-EDIT-</p>
  
  <p>So far I have tried
      <code>git ls-files -i --exclude-from=.gitignore | sed 's/\ /\\\ /g'</code></p>
  
  <p>While that happily outputs the file paths looking as I'd expect, with the spaces escaped.....  When I try to execute </p>
  
  <pre><code>git rm --cached `git ls-files -i --exclude-from=.gitignore | sed 's/\ /\\\ /g'`
  </code></pre>
  
  <p>I get - error: unknown switch `\'</p>
  
  <p>Where I expect something wonky is going on with the pipe.</p>