title: How do you gitignore everything except a directory?
body: <p>I am trying to sync my desktop and laptop using a cron'd git. It works beautifully on a single directory. However I want to sync multiple config files scattered about and some other things. To do this decided to turn my home folder into a git directory and ignore everything except for a few select files and directories.</p>
  
  <pre><code>$ cat .gitignore
  *
  # test is a directory
  !test
  </code></pre>
  
  <p>Does not work. Looking at another stackoverflow question, I found <code>*/</code> and used it instead of <code>*</code>. That almost worked as I wanted it to, but then all of the random single hidden files I have scattered about my home directory showed up.</p>