How to git bundle a complete repo

后端 未结 3 759
陌清茗
陌清茗 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条回答
  •  旧时难觅i
    2020-11-28 18:43

    I would suggest you tar or zip the .git folder and simply unpack it in the new location and then do git reset --hard HEAD. Everything required for all the branches is under .git and all you should need to do is adjust any remotes in the .git/config file or remove them.

    tar cf myrepo.tgz .git
    cp myrepo.tgz [USB_STICK]
    ... move to new machine ...
    mkdir myrepo && cd myrepo
    tar xpf [USB_STICK]/myrepo.tgz
    git reset --hard HEAD
    

提交回复
热议问题