Pull new updates from original GitHub repository into forked GitHub repository

后端 未结 8 832
梦谈多话
梦谈多话 2020-11-22 07:08

I forked someone\'s repository on GitHub and would like to update my version with commits and updates made in the original repository. These were made after I forked my copy

8条回答
  •  攒了一身酷
    2020-11-22 07:46

    Use:

    git remote add upstream ORIGINAL_REPOSITORY_URL
    

    This will set your upstream to the repository you forked from. Then do this:

    git fetch upstream      
    

    This will fetch all the branches including master from the original repository.

    Merge this data in your local master branch:

    git merge upstream/master
    

    Push the changes to your forked repository i.e. to origin:

    git push origin master
    

    Voila! You are done with the syncing the original repository.

提交回复
热议问题