I have an iOS project setup to on github and over the past few days I have started to realize that I need to refactor most of my code. I build the project not abiding by many of the basics of MVC and now want to go back and fix everything.
The main issue is that the project is large enough where refactoring will be a massive pain. Is there anyway that I can start a new project, build it to the place the current one is at (obviously with some major design changes) and push that up to github into the same branch instead of the original project? If this is not clear please let me know.
I would expand on the given answers a bit, given your desire to keep your old history. In this case, you don't want to start a new repo; you just want to "manhandle" the old one, clearing out old data and adding new. You can accomplish this with the following steps:
git status
is going to show you quite a mess (the size of which will depend upon how many files you used to have) of deletions and additions. That's okay, this is where you take a broad brush to all of these entries, with git add --all .
. This will stage everything in your repo, deletions, new additions, all of it.git commit -m "My new beginning"
.git push origin myBranch --force
Voila! Your repository is completely made over, with the added bonus of retaining your previous history.
You can. Just create your new project and type the following commands into a command line interface (cmd in Windows, terminal in linux).
cd /path/to/project
git remote add origin [email protected]:username/repo.git
git push origin master --force
That should do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With