Last active
April 13, 2020 12:13
-
-
Save MarceloZapatta/203baa34bb92ff2f2e88d2dfae6aca7d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # https://stackoverflow.com/questions/2411031/how-do-i-clone-into-a-non-empty-directory | |
| # Thanks: cmcginty, RichardC | |
| git init | |
| git remote add origin PATH/TO/REPO | |
| git fetch | |
| git reset origin/master # Required when the versioned files existed in path before "git init" of this repo. | |
| git checkout -t origin/master | |
| # If "git checkout -t origin/master" falls to "master already exists" | |
| # Do this last two commands instead | |
| git branch --set-upstream-to=origin/master | |
| git ls-files -z --deleted | xargs -0 git checkout -- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment