Developers create multiple new repositories while working on a Git local machine where they can save project files and code versions that can be easily accessible whenever needed and then initialize it. When it is initialized, the “.git/” is created automatically. Moreover, they can uninitialize their repositories by deleting the “.git/” folder.
This blog will talk about the method of uninitializing the Git repository.
How to Uninitialize Git Repository?
Apply the below-given procedure to un-initialize the Git repository:
- Redirect to the desired Git repository.
- Display a list of content, including hidden folders.
- Remove the “.git/” folder by running the “rm -rf .git/” command.
- Verify it by viewing its content.
Step 1: Move to Initialized Git Repository
First, navigate to the Git repository by running the “ls” command with its path:
Step 2: Check Content Including Hidden Files
Then, execute the “ls” command with the “-a” flag to display the current repository content along with hidden:
As you can see, all files and folders are shown. The below-highlighted “.git/” folder indicates that the current working repository is initialized:
Step 3: Remove “.git” Folder
Next, to un-initialize the current working Git repository, remove the “.git” folder by running the “rm” command:
In the above-stated command, the “-r” flag will delete recursively, and the “f” option indicates forcefully removing the protected files:
Step 4: Verify Uninitialized Process
Lastly, run the “ls -a” command to ensure that the current repository is uninitialized or not:
According to the below-given output, the “.git” folder is removed successfully from the repository which indicates that the repository is uninitialized:
You have learned the method of un-initializing a Git repository.
Conclusion
To un-initialize the Git repository, first, move to the desired Git repository and display its list of content, including hidden. Then, remove the “.git/” folder by executing the “rm -rf .git/” command. Lastly, ensure it by displaying its content. This blog explained the procedure of uninitializing the Git repository.