1. 先查看远程分支列表,看是否有远程原始分支
$ git remote -v
origin https://github.com/abc/xyz.git (fetch)
origin https://github.com/abc/xyz.git (push)
如果没有远程原始分支
$ git remote add best https://github.com/best/xyz.git
再次查看远程分支列表
$git remote -v
origin https://github.com/abc/xyz.git (fetch)
origin https://github.com/abc/xyz.git (push)
best https://github.com/best/xyz.git (fetch)
best https://github.com/best/xyz.git (push)
2.fetch原始源分支的新版本到本地
$ git fetch best
3.合并两个版本的代码
$ git merge best/master
4.把最新的代码提交到自己的github上
$ git push origin master
github协同工作时,如何同步代码
最新推荐文章于 2023-11-03 13:24:57 发布