I have a working copy of the project, without any source control meta data. Now, I\'d like to do the equivalent of git-clone into this folder, and keep my local changes.
This is the Best of all methods i came across
Clone just the repository's .git folder (excluding files as they are already in existing-dir) into an empty temporary directory
git clone --no-checkout repo-path-to-clone existing-dir/existing-dir.tmp //might want --no-hardlinks for cloning local repoMove the .git folder to the directory with the files.
This makes existing-dir a git repo.
mv existing-dir/existing-dir.tmp/.git existing-dir/Delete the temporary directory
rmdir existing-dir/existing-dir.tmp
cd existing-dir
Git thinks all files are deleted, this reverts the state of the repo to HEAD.
WARNING: any local changes to the files will be lost.
git reset --mixed HEAD