You’ll need to be more specific: Did you create the repository on GitHub or locally? Did you delete the remote repository on GitHub or your local clone? Where did you create the commits, locally or directly on GitHub?
If you did manage to create one or more commits then it means the repository was indeed initialized. The
git init command creates the scaffolding structure of a bare repository (i.e. the
.git/ folder and its contents), and if you created the repository on GitHub and chose at least one of the options regarding adding a license file or a README document, then the repository was initialized by GitHub on your behalf.
It largely depends on whether you deleted the repository on GitHub or the local clone, and where the lost commits where applied to.
All the repository contents and its past history are stored inside the
.git/ folder — which is a hidden folder, so in order to see it you’ll probably have to change the settings or your file explorer application, or use advanced options in the terminal when listing files (since you didn’t mention your OS I can’t provide specific advise on this).
Since you’re still able to clone your repository I’m assuming you’re finding that folder locally. Git offers various commands to roll back commits or recover lost references (via the reflog), but whether you’ll be able to recover those lost commits largely depends on where you had created them (on GH or locally) and whether you’ve hard-reset the repository or not after the accidental deletion (forced overwriting operations on the repository could affect the possibility of recovering past and lost contents).
When similar situation happen (and they do happen) the best approach is not to panic and avoid attempting drastic approach like manually deleting folders or carrying out hard-resets or force operations until you have a clear picture of what went wrong, where and how — i.e. focus on using read-only commands first, to establish which data is still available locally and remotely in the repository’s reflog/history, so you can plan a strategy for recovering it.
Creating a physical backup of the whole repository (i.e. copying the whole folder or creating a Zip archive of it) as soon as you realize something went wrong is also a good precaution (so you’ll preserve an intact copy of the
By providing more info, as suggested above, you might still have a chance to recover some contents.