Create a backup or a bundle of your git repository
Materials and MethodsWe will use the
git bundleutility inside our local repository and also
git mergeto deploy our bundled repo.
git bundleturns a repository into a single file that retains the versioning information of the entire project.
Here are a list of options that are available:
git bundle create <name-of-the-bundle> <git-rev-list-args> git bundle verify <file> git bundle unbundle <file> [<refname>...]
Create a bundle
git bundle create ../myrepo.bundle master
Counting objects: 43, done. Delta compression using up to 2 threads. Compressing objects: 100% (39/39), done. Writing objects: 100% (43/43), 54.44 KiB | 0 bytes/s, done. Total 43 (delta 8), reused 0 (delta 0)
myrepo.bundle. When we created the file It was like we where just pushing our master branch to a remote, except it’s contained in a file instead of a remote repository.
Verify the bundleBefore we move our bundle its a good idea to verify its content and check that the bundle file is valid and relevant to the current repository.
While you are inside a repo run:
git bundle verify ../myrepo.bundle
The bundle contains this ref: 230b04bdd3367b2db73 refs/heads/master The bundle records a complete history. ../myrepo.bundle is okay
Deploy the bundle
/home/userand you have created a folder
newrepoand initialized a git repository inside it. Here is a generic procedure:
mkdir newrepo cd newrepo git init git bundle unbundle ../myrepo.bundle
HEADof you repo
myrepo.bubdlefile with the one that you initialized inside the
git merge f7243b