How to sync a fork repo to keep it up-to-date with the upstream repo on Windows?


In this article I'll introuduce how to sync a fork repo to keep it up-to-date with the upstream repo on Windows7 or other Win-OS.

Because the sync's operation on Linux&&Unix is easier than on Windows, and the main step is similar.

So the major content of this article is sync repo on Windows.


Before the operation of syncing, we could install the GitHubDesktop, it is a cool tool for using GitHub on windows.

Please set the Default Shell as Git Bash on GitHubDesktop, it can keep the operation in the toolGit Shell  same  as Linux.

PS: The tool Git Shell can open a command window and show command prompt to use git CLI.


First, fork someone else's project repo on GitHub website. Take it easy , you can find and use the fork button step by step on webpage.

    For example, the base repo is A, the fork repo isB.


Then, use the GitHubDesktop to clone the forked repo to local.

     Especially, maybe you'll meet an error likes below:

             GitHub - failed to connect to github 443 windows/ Failed to connect to gitHub - No Error

       The most reason is you need to set the proxy by Git Shell.

              " git config --global http.proxy xxx.xxx.xx.xx:80xx "

                                                             <proxy IP> : <prot>


Third, use the tool Git Shell to open a command window to do some operate like below:

    1), change the current working directory to the local project,

    2), use " git remote -v " to show the all remote URLs of this project.

    3), if there is no other remote URL except origin URL, we should add a new remote URL, typically called upstream.

         the command is: "git remote add upstream <A-project_URL>"

    4), use " git fetch upstream " to fetch the branches and their respective commits form the upstream repository.

    5), checkout your fork's local's master branch: "git checkout master"

    6), merge the changes from upstream/master into your local's master branch:"git merge upstream/master"

    7), commit and push the changes to your fork repo:

          a), " git commit -m "<the message, eg: sync the fork repo to keep it up-to-date with the upstream repo>"  "

          b), " git push origin "


OK, finally , we finished to sync the fork repo to keep it up-to-date with the uptream repo.


God damn it ! 

It is horrible and HELL diffculty to let a Chinese write a blog article in English.

Thank godness, I finish it , hahaha  

   ( ^_^)


QUOTE:

about remote:    https://help.github.com/articles/pushing-to-a-remote/

about fork:          https://help.github.com/articles/fork-a-repo/

about sync:        https://help.github.com/articles/syncing-a-fork/




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值