Github: Import upstream branch into fork

后端 未结 6 459
攒了一身酷
攒了一身酷 2020-12-07 07:24

I have a fork (origin) from a project (upstream) on github. Now the upstream project has added a new branch, I want to import into my fork. How do

6条回答
  •  时光取名叫无心
    2020-12-07 07:44

    1. Make sure you've pulled the new upstream branch into your local repo:

      • First, ensure your working tree is clean (commit/stash/revert any changes)
      • Then, git fetch upstream to retrieve the new upstream branch
    2. Create and switch to a local version of the new upstream branch (newbranch):

      • git checkout -b newbranch upstream/newbranch
    3. When you're ready to push the new branch to origin:

      • git push -u origin newbranch

    The -u switch sets up tracking to the specified remote (in this example, origin)

提交回复
热议问题