Sometimes I clone git repo not for a development – but just for the bleeding edge version. Now I do it with
git clone --depth=1 <URL>
but back then I didn’t know it. So I have some full repos – and I would like to leave only the latest shapshot in each of them. How this can be done?
Edit:
I think that if I will do
rm -rf .git
git init
git add .
git commit
I will lose the origin source – and would not be able to git pull later.
Edit 2:
Perhaps the simplest way is just to delete the repos and
git clone --depth=1 <URL>
them again.
You can, more simply, clone these repositories with the same
--depth=1, and copy the remote repo’s config (see.git/configfile in old repo and copy relevant section to the one in your new repo.