I would appreciate it if someone could tell me how I could delete every single file/folder on my git repository without actually deleting the repository itself. I want to de
As I explain in this answer to Delete or remove all history, commits, and branches from a remote Git repo?, you can also achieve the same thing as Ceilingfish's answer (i.e. delete all references/branches/tags in the remote repo) by doing the following:
Create new empty repo with initial commit:
mkdir new
cd new
echo "This is the README" > README.md
git init
git add .
git commit -m "Add README.md (initial commit)"
Add remote repo as origin:
git remote add origin
Mirror push to remote:
git push origin --mirror
That will delete all references/branches/tags in your remote repo, and any dangling commits will probably be garbage collected eventually. From the official Linux Kernel Git documentation for git push (emphasis mine):
--mirrorInstead of naming each ref to push, specifies that all refs under
refs/(which includes but is not limited torefs/heads/,refs/remotes/, andrefs/tags/) be mirrored to the remote repository. Newly created local refs will be pushed to the remote end, locally updated refs will be force updated on the remote end, and deleted refs will be removed from the remote end.