Cláudio Ribeiro
Cláudio Ribeiro

Reputation: 1699

Duplicate a git repository without history

I want to copy a git repository to another location so I can start working on a different project using that same code base. Is it enough to simply clone the repository and delete the .git folder and run git init or do I have to do some additional work?

Thanks in advance!

Upvotes: 2

Views: 7106

Answers (2)

Błażej Kowalczyk
Błażej Kowalczyk

Reputation: 184

Yes, deleting .git and git init will work. Also use git clone --depth 1 so you won't be downloading history, which you going to delete.

Upvotes: 3

rodrigo
rodrigo

Reputation: 98338

If you only want to keep the working directory but delete all the git history, tags, branches, etc. you can just delete the .git directory and run git init ..

You may want to check also the local .gitignore and .gitattributes files if they exist, so that they conform to the new project needs.

Upvotes: 4

Related Questions