如何从github中的原始回购中将分支分为分叉回购 [英] How to get a branch into a forked repo from the original repo in github

查看:169
本文介绍了如何从github中的原始回购中将分支分为分叉回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经分出了一个私人回购(称为X)。现在在回购X中创建了一个分支。如何让repo X中的分支出现在我的repo X分支中?



示例


  1. 创建的私人回购只有主人

  2. 我在私人回购协议中创建分支

  3. >
  4. 现在我该如何在我的分支中获取此分支

我想要那个分支在我的分支中,以便我可以处理它并向该分支发送拉请求到原始回购。



谢谢

Saad

解决方案

假设您有一个远程设置为专用repo,称为'origin',您可以执行如下:
$ b $ pre $ git fetch origin#从原始仓库中提取历史记录
git checkout -b newBranch origin / newBranch#create一个名为'newBranch'的本地分店,用于追踪原产地的新分店


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

解决方案

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

这篇关于如何从github中的原始回购中将分支分为分叉回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆