Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a command to undo git init?

Tags:

git

git-init

I just Git init'ed a repos with a wrong user, and want to undo it. Is there any command for this? Do I actually have to go in and edit the .git directory?

like image 311
Yarin Avatar asked Jul 09 '10 12:07

Yarin


People also ask

What is the use of git init?

The git init command creates a new Git repository. It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository. Most other Git commands are not available outside of an initialized repository, so this is usually the first command you'll run in a new project.

What happens if you delete the .git folder?

Deleting the . git folder does not delete the other files in that folder which is part of the git repository. However, the folder will no longer be under versioning control.


2 Answers

You can just delete .git. Typically:

rm -rf .git 

Then, recreate as the right user.

like image 158
Matthew Flaschen Avatar answered Sep 20 '22 00:09

Matthew Flaschen


In windows, type rmdir .git or rmdir /s .git if the .git folder has subfolders.

If your git shell isn't setup with proper administrative rights (i.e. it denies you when you try to rmdir), you can open a command prompt (possibly as administrator--hit the windows key, type 'cmd', right click 'command prompt' and select 'run as administrator) and try the same commands.

rd is an alternative form of the rmdir command. http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/rmdir.mspx?mfr=true

like image 45
wordsforthewise Avatar answered Sep 18 '22 00:09

wordsforthewise