问题
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