I vote for keeping everything in a single repository.
- Create a new branch to point to your old code
- Delete all the code and commit on master
- Start your rewrite on master.
This is how:
# checkout the master branch
git checkout master
# create a new branch so you can find the old code easily
git branch oldStuff-KeepingForReference
# push the branch to github
git push origin oldStuff-KeepingForReference
# You currently have the master branch checked out
# so now cd to the project root and start your rewrite:
cd <your project root>
rm -rf *
# Create a commit of the delete
git add --all *
git commit -m "Fresh start"
# Start your rewrite
echo "Some changes" > file.txt
git add file.txt
git commit -m "This is the first commit of the rewrite"
Aside: You could also make a tag of the old legacy code, if you know you will never want to add any commits to it.
When you should create a new repository instead of doing this:
- When your current repo is prohibitively large and cloning the repo is slow. You may want to consider using a new repo.