itamar
itamar

Reputation: 3967

Remove commits before clone (forgot --depth 1)

I forgot to add --depth 1 to my clone before starting a project. Is there a way to remove all commits from before your clone?

Upvotes: 1

Views: 146

Answers (1)

Shaun Luttin
Shaun Luttin

Reputation: 141792

Clone your local repository using the file:// protocol, and if you have made five commits since cloning, use the --depth option with 6.

git clone file://C:/Users/<user>/Documents/my-repo --depth 6 my-repo2

Now you're in the same situation as you would have been if you initially cloned with --depth 1.

Upvotes: 2

Related Questions