Does running git init twice initialize a repository or reinitialize an existing repo?

What happens to an existing git repository when you issue git init again?

I created a repository with git init. Created a file, add, commit. Check the status (nothing to commit). Then created another file, check the status and I can see it’s untracked as expected.

Then, say by mistake, I run git init again and I get Reinitialise existing Git repository message.

Tried git status, but it shows the same. So what really happens?

Can reinitialising an existing git repository this way be harmful or helpful? Why can we git init inside an existing repository?

3 Answers
3

Leave a Comment