what happens when you accidently initialize '/home' as git repository ?

Hello there,

This was a long weekend for us(college mates) as study leave is going on and to make use of it I decided to initialize some pending projects.Yeah! this is like a regular holiday for us.

I had few 'energy drink'(s) and begin my work ,before creating a directory i accidently typed "git init" and initialized my whole /home directory as git repositiory . I ignored that as I was highly 'energetic' and begin my work.

What was the Result of this deed ?

Well, I had around 5000 changes staged for commit in that repository.I opened  Visual Studio Code and clicked on the "Source Control" (or type 'ctrl+shift+g') and found this -


You can also find out this by typing "git diff" or "git diff HEAD".


Why 5000 changes?

There are many changes that takes in the system,for example ,every command you type updates the '.bash_history' and simillary there are many files that gets updated.Those changes were staged for the commit that's why 5000.

There are many hidden directory in /home ,to see them you can hit 'ctrl+h'.The cache files created by different prgrams are kept in '/.cache'.You can delete what's inside but its not recommended.

Solution?

Just delete the '.git' directory from /home .
Or
type 'rm -rf .git' on terminal.


Thanks for being here,Have a good day.