Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

mbo's avatar
Level 3

Remove Github from source code

I'm restarting an project from the past. I have used github on the project. But i want to start with a clean setup.

How can i achieve this? How to clean my source code? Which files do i have to delete?

On githup i can better delete the repository?

Thanks for the helpen.

0 likes
3 replies
andreich1980's avatar

If you don't need anything from the repo - just delete it and create again. If there's something from the very first commits that you need - create a new branch from the commit you need. And you can archive the old branch then.

JohnBraun's avatar
Level 33

I don't know exactly what you're asking, but if you want to reset the git repository just delete the .git directory

rm -rf .git

Next, re-initialize git with git init and define the upstream Github repository. In case you're using the same repo as before, push with the force flag git push -f.

mbo's avatar
Level 3

John,

the current repository comes with issues (not so strange because i didn't push anything for a long time). So i want so start from scratch.

better to delete or to push with force?

thanks for the reaction

Please or to participate in this conversation.