This is the case:
I've accidentally removed the .git folder in my project. How can I undo this that there are no consequences?
Clone it again.
If you have made un-pushed modifications, then clone it in another directory, move the .git to your original directory, and re-add the changes to the index.
If you were working on a branch different from master, then clone it in another directory, checkout to the branch, then move the .git to your original directory, and re-add the changes to the index.
To make sure you don't make another silly mistake, backup your directory before doing anything.