GitHub更新本身Fork的项目

转自:http://www.tuicool.com/articles/MzMJre git

github的fork能够将别人的工程复制到本身帐号下。这个功能很方便,但其有一个缺点是:当源项目更新后,你fork的分支并不会一块儿更新,须要本身手动去更新。 github

以gitHub用户:micmiu (帐号名),fork 项目 sql-parser(https://github.com/FoundationDB/sql-parser) 为例子: sql

一、clone 本身帐号里fork的分支fetch

git clone https://github.com/micmiu/sql-parser.git
cd sql-parser

二、增长远程原始分支到本地(能够用 git remote -v 命令查看远程分支列表)ui

$ git remote -v
origin  https://github.com/micmiu/sql-parser.git (fetch)
origin  https://github.com/micmiu/sql-parser.git (push)

若是没有远程原始分支则须要增长:code

git remote add sql-parser_fdb https://github.com/FoundationDB/sql-parser.git

查看确认远程分支列表:rem

git remote -v
origin  https://github.com/micmiu/sql-parser.git (fetch)
origin  https://github.com/micmiu/sql-parser.git (push)
sql-parser_fdb  https://github.com/FoundationDB/sql-parser.git (fetch)
sql-parser_fdb  https://github.com/FoundationDB/sql-parser.git (push)

三、fetch原始源分支的新版本到本地get

git fetch sql-parser_fdb

四、合并两个版本的代码it

git merge sql-parser_fdb/master

五、把最新的代码提交到github本身(micmiu)的帐号上io

git push origin master
相关文章
相关标签/搜索