How to git bundle a complete repo

后端 未结 3 751
陌清茗
陌清茗 2020-11-28 18:19

I need to transfer a complete repo to a new non-networked machine, preferable as a single file entity. The git bundle allows a git fetch, git pull

3条回答
  •  情深已故
    2020-11-28 18:56

    What is the right invocation to:

    • Bundle all the branches in the current repo

    Simple:

    $ git bundle create repo.bundle --all
    

    Here repo.bundle is the name of bundle file you want to create. Note that --all would not include remote-tracking branches... just like ordinary clone wouldn't either.

    • Start up the new repo on the destination directory, i.e. get the root commit correctly installed

    First, clone is just init + fetch (+ administrativia).

    Second, you can use bundle file everywhere the repository URL can be used, so you can simply clone from a bundle file:

    $ git clone repo.bundle
    

    This would create repo as a git repository.

提交回复
热议问题