How do I update a GitHub forked repository?

前端 未结 23 2820
借酒劲吻你
借酒劲吻你 2020-11-21 11:07

I recently forked a project and applied several fixes. I then created a pull request which was then accepted.

A few days later another change was made by another con

23条回答
  •  爱一瞬间的悲伤
    2020-11-21 12:05

    When you have cloned your forked repository, go to the directory path where your clone resides and the few lines in your Git Bash Terminal.

    $ cd project-name
    
    $ git remote add upstream https://github.com/user-name/project-name.git
     # Adding the upstream -> the main repo with which you wanna sync
    
    $ git remote -v # you will see the upstream here 
    
    $ git checkout master # see if you are already on master branch
    
    $ git fetch upstream
    

    And there you are good to go. All updated changes in the main repository will be pushed into your fork repository.

    The "fetch" command is indispensable for staying up-to-date in a project: only when performing a "git fetch" will you be informed about the changes your colleagues pushed to the remote server.

    You can still visit here for further queries

提交回复
热议问题