git - update fork's master & rebase my branch onto it?

前端 未结 1 433
独厮守ぢ
独厮守ぢ 2021-01-31 12:21

I have forked a github project, then cloned it locally.

I then made some changes in a new branch on my_github/the_project repo.

I then added and com

相关标签:
1条回答
  • 2021-01-31 12:43

    Yes, it's not fetching anything because of the reason you surmised. And yes, you should add a remote for upstream locally; it will do a fast-forward merge on master.

    git checkout master # Make sure you are in master
    git remote add author original_repo_that_you_forked_from
        # Note: This is in the format git@github.com:authors_name/repo_name.git
        #       Only needs definition once, future fetches then use it. 
    git fetch author
    git status # make sure you are in the master branch for the following merge
    git merge author/master  # i.e. 'into' your master branch
    git checkout your-branch
    git rebase master        # Now get those changes into your branch.
    git push origin your_branch # You can also use `-f` if necessary and `--all`
    

    (sorry, I might not have the syntax exactly right)

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