git bundle a range of commits

断了今生、忘了曾经 提交于 2019-12-19 10:51:07

问题


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.

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 ?


回答1:


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 

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 

So instead of pushing directly, you would fetch from the bundle (which acts as a git repo, but presents itself as one file)



来源:https://stackoverflow.com/questions/27861579/git-bundle-a-range-of-commits

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