Github 上怎样把新 commits 使用在自己的 fork 上?

我 fork 了别人的代码,然后做了适合自己的修改。现在他的版本有更新,和我的修改不冲突,我想直接 pull 到自己的 fork 版本中,该怎样做? …
关注者
316
被浏览
64,374

11 个回答

让我来教你只用Github不用命令行的方法:

举例说明: (每一步都有截图)

这一页往下面拉:

这里用

@王月

的repo做了例子, 他的频繁更新让我有了截图的机会~ 感谢他.

玩的愉快!

help.github.com/article

Step 3: Configure remotes

When a repo is cloned, it has a default remote called origin that points to your fork on GitHub, not the original repo it was forked from. To keep track of the original repo, you need to add another remote named upstream:

$ cd Spoon-Knife
# Changes the active directory in the prompt to the newly cloned "Spoon-Knife" directory
$ git remote add upstream github.com/octocat/Spoo
# Assigns the original repo to a remote called "upstream"
$ git fetch upstream
# Pulls in changes not present in your local repository, without modifying your files

Pull in upstream changes

If the original repo you forked your project from gets updated, you can add those updates to your fork by running the following code:

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

Read the friendly manual.

---- 更新:不用命令行的话我也不会了 ----