title: Import a git repository with all its history into an existing git repository
body: <p>I have two git repositories and I want to merge them together without losing their commit histories. I've tried this:</p>
  
  <pre><code>cd firstRepo
  git remote add other path/to/otherRepo
  git fetch other
  git checkout -b otherRepoBranch other/master
  echo "`git rev-list otherRepoBranch | tail -n 1` `git rev-list master | head -n 1`" &gt;&gt; .git/info/grafts
  git rebase otherRepoBranch master
  </code></pre>
  
  <p>Now when I look at the commit history everything looks good, but the only files I have in my repository are now the ones from otherRepo.</p>
  
  <p>Any ideas?</p>