将远程原始repo合并到远程fork repo的本地repo后推送到远程fork repo
- clone远程fork repo
- 添加远程原始repo为upstream
- fetch&merge远程原始repo的分支到本地分支
- push到远程fork repo分支
具体操作
- Set up Git
- Create a local clone of your fork
git clone https://github.com/YOUR-USERNAME/REPO_NAME.git
- Configure Git to sync your fork with the original repository
# check the current configured remote repository for your fork.
git remote -v
# add upstream
git remote add upstream https://github.com/ORIGINAL-USERNAME/REPO_NAME.git
# verify the new upstream repository
git remote -v
- Fetch and merge original repository into your local repository
git fetch upstream
git merge upstream/master
- push to your remote fork repo
git push origin master
本文介绍了如何在fork了一个项目后,通过设置Git的upstream,fetch并merge原项目的最新改动,然后push到自己的fork仓库,从而保持与原项目同步。

943

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



