如何把自己fork别人仓库中的代码更新至最新版本

1,首先把别人的仓库添加到自己的上游远程,通常命名为upstream.

git remote add upstream [原作者的仓库地址]

2,查看当前仓库状态。

git remote -v 

[注]:可以看到一个origin是自己的,另一个upstream是原作者的。

3,在自己本地更新代码。

git checkout [target_branch]

git add xxx

git commit -m xxx

4, 获取原作者代码更新。

git pull upstream [target_branch]

5, 将本地代码提交到自己fork的项目上。

git push origin [target_branch]

CrazyQA
原文地址:https://www.cnblogs.com/wayne-zhang/p/8421238.html