How to sync with a remote Git repository?

前端 未结 5 744
你的背包
你的背包 2020-12-02 06:02

I forked a project on github, made some changes, so far so good.

In the meantime, the repository I forked from changed and I would like to get those changes into my

相关标签:
5条回答
  • 2020-12-02 06:44

    Assuming their updates are on master, and you are on the branch you want to merge the changes into.

    git remote add origin https://github.com/<github-username>/<repo-name>.git
    git pull origin master
    

    Also note that you will then want to push the merge back to your copy of the repository:

    git push origin master
    
    0 讨论(0)
  • 2020-12-02 06:50

    For Linux:

    git add * 
    git commit -a --message "Initial Push All"
    git push -u origin --all
    
    0 讨论(0)
  • 2020-12-02 06:58

    You have to add the original repo as an upstream.

    It is all well described here: https://help.github.com/articles/fork-a-repo

    git remote add upstream https://github.com/octocat/Spoon-Knife.git
    git fetch upstream
    git merge upstream/master
    git push origin master
    
    0 讨论(0)
  • 2020-12-02 07:00

    You need to add the original repository (the one that you forked) as a remote.

    git remote add github (clone url for the orignal repository)

    Then you need to bring in the changes to your local repository

    git fetch github

    Now you will have all the branches of the original repository in your local one. For example, the master branch will be github/master. With these branches you can do what you will. Merge them into your branches etc

    0 讨论(0)
  • 2020-12-02 07:03

    Generally git pull is enough, but I'm not sure what layout you have chosen (or has github chosen for you).

    0 讨论(0)
提交回复
热议问题