Ioanna Katsanou Ioanna Katsanou - 1 month ago 5
Git Question

How to remove or change local git repository though command line

I am quite new to git. When I type

git init
it starts the repository in C:/Users/Ioanna/.git/
I tried manually deleting the .git file from this folder, and it said this:

Initialized empty Git repository in C:/Users/Ioanna/.git/


I want my git repository to be in another custom file I made. How can I achieve this through the command line? Where can I set where my git repository should be?
I need to know, if I don't want a folder to be a repository anymore, and I want to remove git, is it enough to only remove the .git folder ?

Answer

Remove the .git folder with rm -r .git/

You have to go into your working directory (for example cd /c/Users/Ioanna/projects/superprogram/), then perform the git init command there.

This will create a new .git subfolder (/c/Users/Ioanna/projects/superprogram/.git/), which will contain the repository information and history. You can safely ignore it as long as you do not interfere with it.

Comments