Back

Explore Courses Blog Tutorials Interview Questions
+4 votes
1 view
in DevOps and Agile by (19.4k points)
edited by

I created a git repository with git init. I'd like to delete it entirely and init a new one.

1 Answer

+5 votes
by (27.5k points)
edited by

The trick is to remove the file from .git directory since git keeps all of its files in the .git directory. Once you remove that file, init git once again.

Let us see how to find it.

For Windows 7: 

Go to your folder > Click on Organize on the top left > click on Folder and search options > click on the View tab > click on the Show hidden files, folders and drives radio button.

For Mac OS:

Open a Terminal (using Spotlight: press CMD + SPACE > type terminal > press Enter) and do this command: 

defaults write com.apple.finder AppleShowAllFiles 1 && killall Finder

Remember that the keyboard shortcut to show hidden files in Finder is CMD + SHIFT + . so it is no longer necessary to modify the finder config this way

You could type cd (space is important), drag and drop your git repo folder from Finder to the Terminal window, press return, then type rm -fr .git, then return again.

For Ubuntu:

Use shortcut Ctrl + H.

For more commands like this please go through the following tutorial that will help you understand the git
 

 

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94.1k users

Browse Categories

...