git捆绑了一系列的提交 [英] git bundle a range of commits
问题描述
在Github上,我从名为RepoBase的存储库分支到名为RepoForked的私有存储库。然后,我在RepoBase上创建了一个本地分支MyLocalBase,并对它进行了5次提交。
On Github, I have forked from a repository named RepoBase to a private repository named RepoForked. I then went to create a local branch MyLocalBase on RepoBase and made 5 commits to it.
现在我想捆绑MyLocalBase分支中最后5次提交并解压缩它们在RepoForked分支上。我怎样才能做到这一点?
I want to now bundle these last 5 commits I made in MyLocalBase branch and unbundle them on RepoForked branch. How can I do this ?
推荐答案
自然的解决方案是添加一个远程和推送:
The natural solution would be to add a remote and push:
git remote add RepoForked ../path/to/repoForked
git checkout MyLocalBase
git push RepoForked MyLocalBase
但是,如果您必须使用 git bundle
:
But, if you must use git bundle
:
cd RepoBase
git bundle create file.bundle MyLocalBase
cd /path/to/RepoForked
git remote add RepoBase /path/to/file.bundle
git fetch RepoBase
git checkout -b MyLocalBase RepoBase/MyLocalBase
因此,不要直接推送,而是从捆绑中获取(作为一个git仓库,但是将其本身作为一个文件呈现)
So instead of pushing directly, you would fetch from the bundle (which acts as a git repo, but presents itself as one file)
这篇关于git捆绑了一系列的提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!