我们是两个学生,致力于我们的在线存储库(不同的存储库),该存储库是从一个共同的上游存储库派生出来的。
假设其他学生在特定分支上对他的存储库进行了更改、提交和推送。
如何将这些更改 pull 入我自己的本地存储库?
我是否需要将这些更改提交并推送到我的临时区域?
谢谢!
最佳答案
在你的 other
中添加一个新的 Remote (比如 own
) repo 。 pull other/<branch>
更改为您的本地分支机构(例如 add-other-changes
)。推送到您自己的 fork repo ( origin/add-other-changes
)。现在,你什么时候完成 add-other-changes
分支,创建一个 pull 请求并将其与 origin/master
merge .
将其他仓库的更改 pull 入您自己的仓库:
# go into your own repo $ git remote add other <other-student-repo-url> # add a new remote with other's repo URL $ git fetch other # sync/update local with other's repo $ git checkout -b add-other-changes # create a new branch named 'add-other-changes' $ git pull other <specific-branch-name> # pull other/<branch> changes $ git push origin HEAD # push changes to your own(origin) forked repo `add-other-changes` branch
关于Git pull 从别人的fork,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42156971/