1.查看自己当前的远程状态
git remote -v
origin https://github.com/USERNAME/PROJECT.git (fetch)
origin https://github.com/USERNAME/PROJECT .git(push)
upstream https://github.com/ORIGINAL_OWNER/PROJECT.git (fetch)
upstream https://github.com/ORIGINAL_OWNER/PROJECT.git (push)
2.把原仓库的远程仓库添加进来
git remote add upstream https://github.com/ORIGINAL_OWNER/PROJECT.git
3.拉取原仓库代码
git fetch upstream
4.合并代码
使用git merge upstream/master
,把原仓库的代码合并到你的仓库上,如果要合并其他分支可以把master切换到其他分支进行合并
网友评论