已存在文件的项目设置远程Git

by Web全栈工程师 on 2015 年 03 月 24 日

场景:已存在的项目目录,设置git信息

方法一:

git clone https://myrepo.com/git.git temp
mv temp/.git code/.git
rm -rf temp

方法二:

git init
git remote add origin $url_of_clone_source
git fetch origin
git checkout -b master --track origin/master # origin/master is clone's default

参考资料:http://stackoverflow.com/questions/5377960/whats-the-best-practice-to-git-clone-into-an-existing-folder

Comments on this entry are closed.

Previous post:

Next post: