I have a repo on github and I need to complete reset it , i.e start uploading from scratch. How exactly do I remove all files and directories in the repository using git?
Asked
Active
Viewed 129 times
1
-
5Why not just delete the repository itself and create a new one with the same name? – robert Jan 05 '12 at 16:41
-
@robert thanks. I wonder why I didn't think of that. But anyway, I'll wait for an answer, there may be a good solution. – ApprenticeHacker Jan 05 '12 at 16:43
-
Any reason why just removing the files/dirs and committing that wouldn't suffice? – Jani Hartikainen Jan 05 '12 at 16:52
-
@robert you know what, just post a dramatically elaborated version of the above comment as the answer and I'll accept it if no other good answers come by that time. – ApprenticeHacker Jan 05 '12 at 16:53
-
http://stackoverflow.com/questions/253055/how-do-i-push-amended-commit-to-the-remote-git-repo – TheBuzzSaw Jan 05 '12 at 17:08
1 Answers
2
One option is to take your local copy of the new repo, set it up as normal, then run git push --force origin master
(or whatever you’ve named your remote and branch). This won’t actually delete all the files, directories and history (at least not immediately), but they will no longer be reachable from your head, which is all you need unless you really want to make it impossible to retrieve the existing files.

dhwthompson
- 2,501
- 1
- 15
- 11