git 简明教程(2) --获取工程与更新

来源:互联网 发布:淘宝不能网银付款 编辑:程序博客网 时间:2024/04/29 23:30

当要参与github上面的t项目时,首先需要 fork 工程到自己的github帐号中,然后 clone到本地,进行编辑并提交


1.获取工程到自己的github中

在 目标项目 中点击 fork  ,自己的github帐号中

2.clone   -获取工程到本地

git clone https://github.com/username/Spoon-Knife.git# Clones your fork of the repository into the current directory in terminal

3.编辑并上传   参考上篇

git add .

git commit -am 'add files'

git push origin master


4.获取原工程(不是自己github中的工程)的实时更新

git remote add upstream https://github.com/octocat/Spoon-Knife.git# Assigns the original repository to a remote called "upstream"

git fetch upstream# Fetches any new changes from the original repositorygit merge upstream/master# Merges any changes fetched into your working files

此时 工程中的任何更新都会合并入本地工程中。


至此,完成 对 目标工程的跟踪以及对目标文件的提交。


参考 fork a repository



原创粉丝点击