I just initiated a git in a repo with a wrong user and want to undo it. Is there any command for this? Do I actually have to go in and edit the .git directory?
For this you just need to delete .git using:
rm -rf .git
Then you can recreate it with the right user. Thus, you can undo git init.
For more commands like this please go through the following crash course that will help you to understand git well.