title: Stage files, then remote add, then pull - and my files are gone
body: <p>I seem to have lost my afternoon's work in a new repo. Here's what I did:</p>
  
  <ol>
  <li>Created a new project locally and did some work.</li>
  <li>Created a repo on github</li>
  <li><code>git init</code></li>
  <li><code>git add src</code> </li>
  <li><code>git remote add origin git@github.com:Synesso/memx.git</code></li>
  <li><code>git pull origin master</code></li>
  <li><code>git add .gitignore</code></li>
  <li><code>git commit -m 'updated ignore'</code></li>
  <li><code>git push origin master</code></li>
  </ol>
  
  <p>Both my local repo and the github repo have only two commits. The initial commit (made by github on project creation) and a second one that includes only the file <code>.gitignore</code>.</p>
  
  <p>The files added in step 4 (<code>git add src</code>) are not present. Nor do they appear to be staged.</p>
  
  <p>Do you lose staged files when you do a <code>git pull</code>? Can I retrieve them somehow?</p>
  
  <p>Current state:</p>
  
  <pre><code>$ git status
  # On branch master
  nothing to commit (working directory clean)
  </code></pre>
  
  <p>My inital <code>add</code> is not in the reflog.</p>
  
  <pre><code>$ git reflog
  c80135d HEAD@{0}: checkout: moving from 999d128ea4e6969f9eacbceebb5f857f2aa5abb0 to master
  999d128 HEAD@{1}: checkout: moving from master to HEAD~1
  c80135d HEAD@{2}: checkout: moving from 999d128ea4e6969f9eacbceebb5f857f2aa5abb0 to master
  999d128 HEAD@{3}: checkout: moving from master to 999d128ea4e6969f9eacbceebb5f857f2aa5abb0
  c80135d HEAD@{4}: commit (amend): updated ignore
  28b4f90 HEAD@{5}: commit: updated ignore
  999d128 HEAD@{6}: initial pull
  </code></pre>
  
  <p><code>history</code> shows that I added the <code>src</code> folder, but did not commit it:</p>
  
  <pre><code>223  git init
  225  git add src
  229  git add project/Build.scala
  234  git remote add origin git@github.com:Synesso/memx.git
  250  git pull origin master
  </code></pre>
  
  <p>I know git will complain if you try to pull with dirty files present. But it's OK with doing a pull that will obliterate staged files? That seems wrong.</p>
  
  <hr>
  
  <p>I've just tested this process again and yes, it destroys staged files.</p>
  
  <pre><code>jem@jem-usb:~/projects$ mkdir x
  jem@jem-usb:~/projects$ cd x
  jem@jem-usb:~/projects/x$ git init
  Initialized empty Git repository in /home/jem/projects/x/.git/
  jem@jem-usb:~/projects/x$ echo "hi" &gt; hello.world
  jem@jem-usb:~/projects/x$ git add hello.world
  jem@jem-usb:~/projects/x$ git status
  # On branch master
  #
  # Initial commit
  #
  # Changes to be committed:
  #   (use "git rm --cached &lt;file&gt;..." to unstage)
  #
  #       new file:   hello.world
  #
  jem@jem-usb:~/projects/x$ ls -asl
  total 24
   4 drwxrwxr-x 3 jem jem 4096 Apr 28 20:56 .
   4 drwxr-xr-x 8 jem jem 4096 Apr 28 20:56 ..
   4 drwxrwxr-x 7 jem jem 4096 Apr 28 20:56 .git
  12 -rw-rw-r-- 1 jem jem    3 Apr 28 20:56 hello.world
  jem@jem-usb:~/projects/x$ git remote add origin git@github.com:Synesso/memx.git
  jem@jem-usb:~/projects/x$ git reflog
  fatal: bad default revision 'HEAD'
  jem@jem-usb:~/projects/x$ git pull origin master
  remote: Counting objects: 7, done.
  remote: Compressing objects: 100% (5/5), done.
  remote: Total 7 (delta 0), reused 3 (delta 0)
  Unpacking objects: 100% (7/7), done.
  From github.com:Synesso/memx
   * branch            master     -&gt; FETCH_HEAD
  jem@jem-usb:~/projects/x$ ls -asl
  total 36
   4 drwxrwxr-x 3 jem jem 4096 Apr 28 20:53 .
   4 drwxr-xr-x 8 jem jem 4096 Apr 28 20:52 ..
   4 drwxrwxr-x 8 jem jem 4096 Apr 28 20:53 .git
  12 -rw-rw-r-- 1 jem jem   59 Apr 28 20:53 .gitignore
  12 -rw-rw-r-- 1 jem jem    9 Apr 28 20:53 README.md
  jem@jem-usb:~/projects/x$ git reflog
  c80135d HEAD@{0}: initial pull
  </code></pre>
  
  <p>The file <code>hello.world</code> was deleted without warning.</p>