I have a central repo with, say, three branches, branchA
, branchB
, and branchC
. I make some commits in, say, branchB
. Then I need to copy the commits to another platform that I can't reach over a network. So I make a bundle. The last bundle I made was at, say, commit 123456f
. So I create my bundle by:
> git bundle create myrepo.bundle 123456f..HEAD
Now, remembering that this was done on branchB
, at my other platform, if I have checked out branchB
, I try to incorporate the changes in the bundle with
> git fetch myrepo.bundle HEAD:branchB
but I am told
fatal: Refusing to fetch into current branch refs/heads/replace_pipeline_codes of non-bare repository
I can fix this by checking out out branchA
(or C
) instead, and running the same fetch command from there. But this is awkward and immediately raises the question of what do I do if I have a repo with only one branch?
So what do I do in that case, and is there a way to convince git to fetch a bundle into an active branch?
By the way, this is similar to this question, but in that question there is no mention of bundling, so I don't see how the answers there apply here.