How to get a branch into a forked repo from the original repo in github

我们两清 提交于 2019-12-12 06:49:20

问题


I have forked a private repo (called X). Now in repo X a branch is created. How do I get the branch in repo X to appear in my fork of repo X?

Example

  1. a private repo is created only has master
  2. I fork private repo
  3. a branch is created in private repo
  4. now what do I do to get this branch in my fork

I would like to have that branch in my fork so that I can work on it and send a pull request for that branch to the original repo.

Thanks

Saad


回答1:


Assuming that you have a remote set up for the private repo called 'origin', you can do the following:

git fetch origin                             # fetches history from origin repo
git checkout -b newBranch origin/newBranch   # create a local branch called 'newBranch' that tracks origin's newBranch


来源:https://stackoverflow.com/questions/19705524/how-to-get-a-branch-into-a-forked-repo-from-the-original-repo-in-github

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!