在GitHub中分叉 - 主线提交

时间:2016-12-13 13:33:52

标签: git github

在Github中,当一个仓库,一个仓库,所有的内容被复制到一个新的fork仓库。我想知道如果在原始仓库中发生了提交,那么我也可以在fork中发生这种情况。如果是这样我怎么能这样做?

还可以更改分叉的名称吗?

1 个答案:

答案 0 :(得分:1)

您可以下载original/repo。然后根据需要在个人帐户中使用new/repo创建different name(包含已下载的文件)。然后转到new/repo

$ git remote add upstream <original/repo/url>
$ git fetch upstream

$ git diff HEAD..upstream/master       # compare between HEAD and origin-repo-master if any change occurs 

# you can also pull original-repo-master-branch in another branch here and see the commit lists
$ git checkout -b <test-branch>
$ git pull upstream master            # pull upstream(original repo) master into local `test-branch`

$ git log                             # see the commit lists 

# You can take an original-repo-commit by `cherry-pick` manually. Copy the `commit-hash` from `git log`

$ git checkout master
$ git cherry-pick <commit-sha>        # take the original-repo-commit manually