I've just finished a git clone here on a new computer, and I now have the repo in an interesting state:
There is no branch checked out. The working directory is empty, but the repo is all here, compressed in the .git metadata.
Of course, the missing step here is to do a git checkout
to get the working copy onto a branch, but this state got me thinking. This is a fairly large repo, one which I don't expect to need access to very frequently either, so I'm now wondering, is there a way to return to this 'clean' state, where no branches are checked out, and the files exist only as metadata?
It would go a long way in saving up some disk space.
I thought about deleting all local files once I'm done, but that would then show up as uncommitted removals on that branch. I'd like to find out if there is a way to simply 'clear out' the working directory, disconnecting it from all branches on the repo, and leaving only the metadata in the repo directory.
One possible solution here might be to create a branch where all files are deleted, but that doesn't sound very elegant. Maybe a more direct approach exists?
As always, thanks in advance!
Cheers