假设来源为 https://github.com/_update_stream/_project.git
fork 项目为 https://github.com/_origin/_project.git
检出自己的项目
git clone https://github.com/_origin/_project.git
关联远程分支
进到 _project 目录下,然后增加远程分支(fork的分支),名为 update_stream(名字任意)到本地
git remote add update_stream https://github.com/_update_stream/_project.git
查看分支
运行命令:git remote -v, 会发现多出来了一个update_stream的远程分支
git remote -v
拉取远程分支代码
git fetch update_stream
合并代码
合并对方远程原始分支 update_stream 的代码
git merge update_stream/master
更新代码
最后把最新的代码推送到你的github上
git push origin master
如果需要给update_stream发送Pull Request
打开 https://github.com/_origin/_project.git
点击Pull Request -> 点击New Pull Request -> 输入Title和功能说明 -> 点击Send pull request
本文介绍如何通过Git命令从远程仓库同步代码到个人Fork的项目中,并发起Pull Request进行代码合并。主要内容包括检出项目、关联远程分支、拉取最新代码、合并更新、推送代码及发起Pull Request。
1423

被折叠的 条评论
为什么被折叠?



