DevWiki

Fork Git仓库的某个分支
1. 本地新建仓库空目录,然后初始化mkdir GitStudyNew cd GitStudyNew ...
扫描右侧二维码阅读全文
10
2018/04

Fork Git仓库的某个分支

1. 本地新建仓库空目录,然后初始化

mkdir GitStudyNew

cd GitStudyNew
                                     
git init                                                                   

2. 添加要复制代码的远程仓库地址

git remote add origin git@github.com:Dev-Wiki/GitStudy.git

3.获取原仓库要复制的分支然后检出

这里以 develop分支操作, 作为新仓库的 master 分支

git fetch origin develop

git checkout -b master origin/develop

4.去除原仓库远程地址, 设置新地址并推送

git remote remove origin

git remote add origin git@github.com:Dev-Wiki/GitStudyNew.git

git push --set-upstream origin master

5. 项目地址

Dev-Wiki/GitStudy: Git学习项目

Dev-Wiki/GitStudyNew

Last modification:April 19th, 2018 at 10:47 am
If you think my article is useful to you, please feel free to appreciate

Leave a Comment