Last active
September 19, 2019 08:03
-
-
Save quimic-gist/2a607cef1f36d9803ba5b228b8692479 to your computer and use it in GitHub Desktop.
Sync with repo without cloning (keeping local files)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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