Le ven. 5 juin 2020 à 00:00, Werner LEMBERG <
wl@gnu.org> a écrit :
This is the first time ever that I got a git bundle to handle, and I'm
stuck. I don't know how to apply it to the git repository. Trying
git pull freetype2-remove-macro-includes.bundle
results in
fatal: Couldn't find remote ref HEAD
Ditto for `git fetch`.
Please advise.
No problem :-) there are several ways to use bundles (and I agree the documentation is lacking):
1) The easy way: use it as a git remote:
$ git remote add bundle /path/to/bundle
$ git fetch bundle
From /home/david/Downloads/freetype2-remove-macro-includes.bundle
* [new branch] remove-macro-includes -> bundle/remove-macro-includes
This is convenient because this fetches all the heads from the bundle at once, and gives you remote branches for all the heads in the bundle.
2) The hard way: git fetch /path/to/bundle <ref>
Where <ref> is one of the references listed by "git bundle list-heads /path/to/bundle". For this specific bundle:
$ git bundle list-heads ~/Downloads/freetype2-remove-macro-includes.bundle
2ebe58073a90538b64170fc274dc5530032726d8 refs/heads/remove-macro-includes
So you could then try:
$ git fetch ~/Downloads/freetype2-remove-macro-includes.bundle remove-macro-includes
From /home/david/Downloads/freetype2-remove-macro-includes.bundle
* branch remove-macro-includes -> FETCH_HEAD
Note that the fetch only creates FETCH_HEAD (which will be overwritten on a future fetch), so you don't have a label defined in your repository.
You can create a branch from it easily with:
$ git branch remove-macro-includes FETCH_HEAD
Hope this helps. Let me know if you prefer a different format. I can probably attach patch files generated with "git format-patch" as well, but bundles are far more convenient and safe.
- David
PS: To create a bundle that includes all patches from origin/master to a local branch, use:
$ git bundle create /path/to/new/bundle origin/master..my_branch
This creates a head named "my_branch" in the bundle.
Werner