两种更新GitHub仓库的方法
两种更新GitHub仓库的方法
一、通过浏览器直接更新
-
打开你的GitHub仓库
me/projectName.
点击 Compare : -
如果你的仓库已是最新的,你就会看到:
如果你的仓库需要更新,你会看到:点击 switching the base, 你会看到你上次更新后所有提交到
someone/projectName的修改. -
点击 Creat pull request:
填写标题和描述,然后点击 Creat pull request.
-
滚到页面底部然后点击 Merge pull request,然后 Confirm merge.这时,你的仓库就已经是最新的了.
二、通过本地仓库进行同步
-
把你GitHub仓库克隆到本地目录下:
git clone https://github.com/your_github/repositoryName.git -
尝试
git remote -v, 如果你只能看到你自己的origin(fetch/push),那就需要你手动添加另一个远程仓库然后命名为 upstream:
git remote add upstream https://github.com/someone/repositoryName.git -
合并主仓库:
git fetch upstream
git merge upstream\master -
现在, 你的本地仓库已经是最新的了.但GitHub仓库还是老的.所以你需要推送更新到你的GitHub仓库.
git push origin master

浙公网安备 33010602011771号