title: How to pull from repo with rebase without getting older commits
body: <p>I have a parent repo which has almost 900 commits and I am creating child repo from it. I have tried almost all possible variations I know including using parent repo as <a href="https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-template-repository" rel="nofollow noreferrer">template</a>.</p>
  <p>What I want to achieve is simillar to what repo template provides. I want to start with fresh repo with single commit. The problem arise when I pull from parent repo (it brings all 900 commits of parent repo in child repo's commit history). I also tried several variations for pulling template/upstream changes. Below is some of the commands I have used.</p>
  <blockquote>
  <p>I have set template repo as <code>upstream</code> using <code>git remote add upstream &lt;template-repo-url&gt;</code></p>
  </blockquote>
  <pre class="lang-sh prettyprint-override"><code>git pull upstream main
  </code></pre>
  <pre class="lang-sh prettyprint-override"><code>git merge upstream/main
  </code></pre>
  <p>If I use template repo approach and pull from child, I get unrelated histoies error on first pull. But this brings all the 900 commits if I use <code>--allow-unrealted-histories</code>.</p>
  <p>Finally, I want to know how can I create child repo from parent repo starting with single commit and get all the changes (commits) (I prefer using rebase as that will bring separate commits to child repo for details on what has been fixed).</p>
  <pre><code>Parent repo:
  900 commits
  --- (at this point I create child repo)
  fixed(layout): navbar overlay
  feat(demo): add code snippets
  </code></pre>
  <pre><code>child repo:
  single commit
  --- (Above is all the commits of parent repo in single commit when I created child repo)
  (now get all the commits separately)
  fixed(layout): navbar overlay
  (there might me child repo's own commits...)
  feat(demo): add code snippets
  </code></pre>
  <p>I can also drop the idea of using templates If I can achieve above illustrated commits history.</p>