Slight variation from Titas's answer, without touching your master
branch, and squashing on a new branch (that you would push to your new repo)
git remote add newrepo url://of/your/new/repo
git checkout -b newbranch master
git merge --squash master
git push -u newrepo newbranch:master
But that would push the full history of master, +1 (squashed) commit, on your new repo.
If you wanted a branch new history, with your repo as after the 5 new commits, it is easier to:
- clone locally your repo,
- remove the
.git
in that local clone, git init.
(ie, re-create a new local git repo from all the existing files),- add everything and do one commit,
- add your remote (to your new remote repo),
- and push that one commit of your new local repo.