Skip to content

Instantly share code, notes, and snippets.

@quimic-gist
Last active September 19, 2019 08:03
Show Gist options
  • Save quimic-gist/2a607cef1f36d9803ba5b228b8692479 to your computer and use it in GitHub Desktop.
Save quimic-gist/2a607cef1f36d9803ba5b228b8692479 to your computer and use it in GitHub Desktop.
Sync with repo without cloning (keeping local files)
#This will leave local unmanaged files untouched
# Clone just the repository's .git folder into an empty temporary directory
git clone --no-checkout my-project-repo my-project.tmp # might want --no-hardlinks for cloning local repo
# Move the .git folder to the directory with the files.
mv my-project.tmp/.git ./
# Delete the temporary directory
rmdir my-project.tmp
# 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 --hard HEAD
#test update from visual studio
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment