Created
May 23, 2018 08:19
-
-
Save AndroPlus/bbd6dc7154634e77c404f47635196d53 to your computer and use it in GitHub Desktop.
Git clone into an existing directory
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
Git clone into an existing directory | |
Here am explaining how to clone a remote git repo to an existing folder (assume this folder has some untracked files). | |
Go to the existing folder in terminal | |
Run $git init | |
Run $git remote add origin <your git repo url> | |
Run $git fetch | |
Run $git checkout -t origin/master (This works better for an empty directory, wont suit for a non-empty directory) | |
Run $git reset origin/master if you have some files in your local existing directory. | |
View the current repo status $git status | |
Stage your file for commit $git add -f *.* | |
Commit your files $git commit -m “message” | |
Push your changes $git push origin master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment