rogerxu / git-tips

Tips for Git
Apache License 2.0
2 stars 3 forks source link

Git clone from another directory #29

Open rogerxu opened 7 years ago

rogerxu commented 7 years ago

How to clone the repo from folder1 to folder2?

rogerxu commented 7 years ago

Clone from another directory

git clone /c/git/folder1/ /d/git/folder2 --progress

git clone from another directory - Stack Overflow

Full copy one repository to another (including commit’s history and branches).

git clone --mirror {{url://to/old_repo}}
cd {{old_repo}}
git remote add new-origin {{url://to/new_repo}}
git push new-origin --mirror

Cloning only special directory from an old repository to new one with saving history of all changes.

mkdir {{/path/to/new_repo}}
git init --bare
cd {{/path/to/old_repo}}
git subtree split --prefix={{directory_name}} -b split
git push {{/path/to/new_repo}} split:master
cd {{/path/to/new_repo}}
git remote add origin {{url://to/new_repo}}
git push origin master
rogerxu commented 7 years ago

Clone from another computer

git clone //computer1/git/folder1/ folder2 --progress

GIT clone repo across local file system in windows - Stack Overflow