Skip to content

Instantly share code, notes, and snippets.

@ZenToad
Created June 30, 2017 17:29
Show Gist options
  • Save ZenToad/74ba6e6e1ac26b39dbde351dd6012112 to your computer and use it in GitHub Desktop.
Save ZenToad/74ba6e6e1ac26b39dbde351dd6012112 to your computer and use it in GitHub Desktop.
git bundle info
# on hostA, the initial home of the repo
hostA$ git bundle create hostA.bundle --branches --tags
# transfer the bundle to hostB, and continue:
hostB$ git clone /path/to/hostA.bundle my-repo
# you now have a clone, complete with remote branches and tags
# just to make it a little more obvious, rename the remote:
hostB$ git remote rename origin hostA
# make some commits on hostB; time to transfer back to hostA
# use the known master branch of hostA as a basis
hostB$ git bundle create hostB.bundle ^hostA/master --branches --tags
# copy the bundle back over to hostA and continue:
hostA$ git remote add hostB /path/to/hostB.bundle
# fetch all the refs from the remote (creating remote branches like hostB/master)
hostA$ git fetch hostB
# pull from hostB's master, for example
hostA$ git pull
# make some commits on hostA; time to transfer to hostB
# again, use the known master branch as a basis
hostA$ git bundle create hostA.bundle ^hostB/master --branches --tags
# copy the bundle to hostB, **replacing** the original bundle
# update all the refs
hostB$ git fetch hostA
# and so on and so on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment