How to attach a git bundle to an existing repository checkout

Viewed 189

I got a file.bundle via email. I can unpack it as documented in the manpage ("git clone" on the file in a git-init'ed temp folder). But actually, it's not what I needed. The bundle contains a small extra branch for an existing repo. So it should be simply attached to an existing workdir.

But when I to embed it there, it does not work. I tried to use "git remote add foo " but it cannot fetch from it (usual "not a remote" message). Although .git/config remote entry looks exactly like in the experimental temp checkout's config.

Am I missing something? Is there a sane way to just attach that bundle as as regular remote source? (read-only is sufficient)

1 Answers

You don't need to configure the file as a remote, you just fetch or pull from it directly. If you fetch to a non-current (for example, a new) branch:

git fetch /path/to/file.bundle newbranch:mybranch

This fetches branch newbranch from the bundle and update (or create a new) local branch mybranch.

To update the currently checked out branch (let's name it master):

git pull /path/to/file.bundle master
Related