更新 Github 上分叉存储库的多个分支
我有一个分叉的 github 存储库(称为 repo-O,称为我的分叉 repo-F),其中包含大约 8 个分支。其他贡献者已在 repo-O 的多个分支上对 repo-O 进行了多次(100 次)提交。我现在想将这些更改放入我的分叉存储库 (repo-F) 中。我无法使用 fork 队列,因为有大约 3000 个提交需要挑选,我更愿意从命令行执行此操作。
所以..我已经克隆了我的存储库,添加了repo-O作为远程(上游)并获取了更改,然后合并了origin/upstream...然后推回了repo-F。
这似乎已将更改应用于主分支,但未应用于任何其他分支......
我如何重复上述过程以便更新“所有”分支?
谢谢
I have a forked github repository (call it repo-O and call my fork repo-F) which contains about 8 branches. Several (100s) commits have been made to repo-O from other contributors, and on multiple branches of repo-O. I would now like to pull these changes into my forked repo (repo-F). I cant use the fork queue as there are about 3000 commits to pick through, and I would much rather do this from the command line.
So.. I have cloned my repo, added repo-O as a remote (upstream) and fetched the changes, followed by merge origin/upstream... then a push back to repo-F.
This appears to have applied the changes to the master branch, but not to any other branch....
How can I repeat the above process so that 'all' the branches are updated?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您想要完成的是“对于 repo-o 上的每个远程分支,创建指向 repo-o 分支的相同分支(如果我没有),或者从 repo 上同一分支上的任何内容提取本地分支上的信息- o,最后将所有这些分支推送到我的 repo-f”。
假设您的遥控器确实名为
repo-o
和repo-f
,我会在bash
中使用类似的内容:对于所有“repo o 分支”(由 gitbranch -a 显示为“repo-o/branchname”,不带“空格和‘repo-o/’”部分),
git pull --rebase repo-obranchname
,git checkout
失败(因为您没有该分支) :检出一个以 repo-o 的分支名称命名的新分支,并将其指向 repo-o 的分支名称。调味;最好在新创建的
repo-f
git 克隆上尝试,并添加远程repo-o
,以防万一出现问题;)What you want to accomplish is "for each remote branch on repo-o, create the same branch pointing to repo-o's branch if I don't have it or pull information on the local branch from whatever is on the same branch on repo-o, and at the end push all these branches to my repo-f".
Assuming your remotes are really named
repo-o
andrepo-f
, I'd play with something like, inbash
:For all "repo o branches" (shown by
git branch -a
as " repo-o/branchname", without the "spaces and 'repo-o/'" part of it),git pull --rebase repo-o branchname
inside it,git checkout
fails (as you do not have that branch): checkout a new branch named after the repo-o's branch name and point it to repo-o's branchname.Season to taste; best tried on a newly created git clone of
repo-f
with the remoterepo-o
added to it, just in case things go wrong ;)awk 版本有一些合并分支
awk version with some merge treaks