Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it safe to delete my git directory? Cloned in the wrong location

Tags:

git

noob alert: I am learning version control and started a job in a company that uses git. I did git clone to pull the company code base to my machine, but I pulled it into a wrong directory. Can I delete this directory on my machine by issuing a rm -rf * or something along those lines and redo the clone to the preferred directory?

I just want to make sure its safe to do this, I dont want to destroy the company's codebase.

Thank you in advance.

like image 914
Doublespeed Avatar asked Mar 20 '13 14:03

Doublespeed


People also ask

What happens if I delete .Git directory?

The folder is created when the project is initialized (using git init ) or cloned (using git clone ). It is located at the root of the Git project repository. If we delete the . git folder, the information saved by Git will be lost, and the directory will no longer act as a Git repository.

Can I delete cloned Git repository?

There's not trick in terms of how to delete a Git repo locally from your computer. You just need to delete all of the content from the folder in which the Git repo was either cloned or initialized. That's it.

What is the default location for Git clone?

The default directory for cloning should be %USERPROFILE%/Documents/GitHub #1663.

Are Git clones tracked?

The git clone command initializes a new repository with the contents of another one and sets up tracking branches in the new repository so that you can easily coordinate changes between the two with the push/pull mechanism.


1 Answers

Yes, you can do that. It will only delete your local copy.

Having said that, the easier way probably will be to simply move it to the preferred location.

Each git repository is self contained and doesn't care about where it has been cloned to.

like image 94
Daniel Hilgarth Avatar answered Oct 07 '22 00:10

Daniel Hilgarth