title: Why doesn't "cp -a" also copy and preserve all git files?
body: <p>Because of some directory changes, I need to copy my local development directory to a new location. This development directory is using git to sync to a external git repo. Recently there were some new file changes made that was not committed and pushed to that external repo. My wish is to just copy everything to a new directory and continue git'ing where I left of. </p>
  
  <p>In original directory:</p>
  
  <pre><code>~/original_dir $ git status
  
  On branch master
  Your branch is up-to-date with 'origin/master'.
  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:   .idea/misc.xml
      modified:   ...
  
  Untracked files:
    (use "git add &lt;file&gt;..." to include in what will be committed)
  
      ../README.md
      ...
  
  no changes added to commit (use "git add" and/or "git commit -a")
  </code></pre>
  
  <p>After doing <code>cp -a ~/original_dir ~/new_dir</code>, I simply get:</p>
  
  <pre><code>~/new_dir $ git status
  
  fatal: Not a git repository (or any of the parent directories): .git
  </code></pre>
  
  <p>Inspection shows that .git is missing from root directory of copy. This is quite concerning as I have been using <code>cp -a</code> for backups. Which mean that <code>cp -a</code> cannot be trusted to copy everything. (According to man pages, <code>-a</code> is "same as <code>-dR --preserve=all</code>".)</p>
  
  <p><strong>What is the proper cp command to have an exact snapshot of that directory?</strong></p>
  
  <hr>
  
  <p><strong>NOTE:</strong> Using <code>tar -cf old_dir.tar old_dir</code> and then extracting this, <strong>does</strong> yield an exact directory copy, that can also be used to continue your git operations as you left off. </p>