复制仓库
2014-01-23 11:28
381 查看
例:使用在GitHub.com上Spoon-Knife项目
1、复制Spoon-Knife仓库
在GitHub.com 仓库点击“Fork”按钮
2、Clone your fork(分支)
复制fork到你本地机器上
git clone https://github.com/username/Spoon-Knife.git #Clones your fork of the repository into the current directory in terminal
3、Configure remotes配置远端
完成仓库复制后,它有一个默认称为origin的远端指向你在GitHub上的分支,而非最原始仓库。为跟踪最原始仓库,你必须添加另一个名为upstream远端
$cd Spoon-Knife
# Changes the active directory in the prompt to the newly cloned
"Spoon-Knife" directory
$git remote add upstream https://github.com/octocat/Spoon-Knife.git # Assigns the original repository to a remote called "upstream"
git fetch upstream
# Pulls in changes not present in your local repository, without modifying your files提取变化不会显示在你本地仓库里,不会改变你的文件
你还可以做更多的事
1、Push commits
$git push origin master
# Pushes commits to your remote repository stored on GitHub
上传文件到远端仓库
2、Pull in upstream changes提取upstream更新
$git fetch upstream
# Fetches any new changes from the original repository
git merge upstream/master
# Merges any changes fetched into your working files
pull和fetch区别:
$git pull upstream master
# Pulls commits from 'upstream' and stores them in the local repository
pull自动完成merge,并保存到你的仓库
$git fetch upstream
# Fetches any new commits from the original repository
$git merge upstream/master
# Merges any fetched commits into your working files
3、创建分支
$git branch mybranch
$git cheakout mybranch切换到分支
$git checkout master切换到主分支
$git merge mybranch 合并分支到主分支
$git branch -d mybranch删除分支
4、pull requests
如果你想对项目有所贡献,你可以发送给原作者pull request
1、复制Spoon-Knife仓库
在GitHub.com 仓库点击“Fork”按钮
2、Clone your fork(分支)
复制fork到你本地机器上
git clone https://github.com/username/Spoon-Knife.git #Clones your fork of the repository into the current directory in terminal
3、Configure remotes配置远端
完成仓库复制后,它有一个默认称为origin的远端指向你在GitHub上的分支,而非最原始仓库。为跟踪最原始仓库,你必须添加另一个名为upstream远端
$cd Spoon-Knife
# Changes the active directory in the prompt to the newly cloned
"Spoon-Knife" directory
$git remote add upstream https://github.com/octocat/Spoon-Knife.git # Assigns the original repository to a remote called "upstream"
git fetch upstream
# Pulls in changes not present in your local repository, without modifying your files提取变化不会显示在你本地仓库里,不会改变你的文件
你还可以做更多的事
1、Push commits
$git push origin master
# Pushes commits to your remote repository stored on GitHub
上传文件到远端仓库
2、Pull in upstream changes提取upstream更新
$git fetch upstream
# Fetches any new changes from the original repository
git merge upstream/master
# Merges any changes fetched into your working files
pull和fetch区别:
$git pull upstream master
# Pulls commits from 'upstream' and stores them in the local repository
pull自动完成merge,并保存到你的仓库
$git fetch upstream
# Fetches any new commits from the original repository
$git merge upstream/master
# Merges any fetched commits into your working files
3、创建分支
$git branch mybranch
$git cheakout mybranch切换到分支
$git checkout master切换到主分支
$git merge mybranch 合并分支到主分支
$git branch -d mybranch删除分支
4、pull requests
如果你想对项目有所贡献,你可以发送给原作者pull request
相关文章推荐
- Fork - 将 GitHub 的某个特定仓库复制到自己的账户下
- 软件架构风格整理(5 仓库风格 6复制风格) .
- maven复制jar包到本地仓库
- MAVEN复制一个仓库的依赖到另一个仓库
- docker 镜像仓库 Harbor 部署、 跨数据复制、升级
- git如何复制远程仓库
- 将SVN仓库里面的一个文件夹的所有内容复制到另一个文件夹下
- docker 镜像仓库 Harbor 部署 以及 跨数据复制
- 软件架构风格整理(5 仓库风格 6复制风格) .
- 使用VSTS的Git进行版本控制(一)——复制现有仓库
- GoldenGate_Oracle数据仓库解决方案——集中复制配置
- 使用VSTS的Git进行版本控制(一)——复制现有仓库
- OGG数据仓库以及单向复制(二)
- SourceTree推送时,增加额外的远程仓库,不用每次都自定义粘贴复制网络
- OGG数据仓库以及单向复制(一)
- GIT: 远程建立一个仓库,然后复制到本地
- OGG数据仓库以及单向复制(二)
- Google揭开Mesa的神秘面纱——一个具备跨地域复制和近实时特性的可伸缩数据仓库
- OGG数据仓库以及单向复制(一)
- 使用TableDiff实用工具解决事务复制中的问题