用github还处于菜的阶段,遇到问题简单记录。
本地 clone 自己 repo 中的这个项目
添加自己的远程仓库
$ cd WebFundamentals
修改代码后进行 push
$ git add --all
$ git commit -m ‘edit some files‘
$ git push
这时候,如果源仓库 tarobjtu 的项目代码进行了更新,而我们自己 fork 下来的代码想要合并这些更新怎么做呢?
添加源项目的远程仓库
$ git remote
// laispace // tarobjtu
拉取源仓库的代码到本地
$ git fetch tarobjtu
合并源仓库的 master 分支代码到本地
$ git merge tarobjtu/master
提交代码到我们自己的仓库
$ git add --all
$ git commit -m ‘合并源仓库代码‘
$ git push
这样自己的github就是最新的了,与原始的代码同步。有更新的代码贡献。 可以pull request
转自:https://github.com/laispace/laispace.com/blob/master/source/_posts/Git-fork-%E5%88%AB%E4%BA%BA%E7%9A%84%E9%A1%B9%E7%9B%AE%E5%90%8E%E6%9B%B4%E6%96%B0%E4%BB%A3%E7%A0%81%E7%9A%84%E6%96%B9%E6%B3%95.md
github Git-fork-别人的项目后更新代码的方法
原文:http://www.cnblogs.com/zhishuai/p/7831441.html