The git
command gives us the ability to bundle a repository along with its branches and tags.
This is useful if we want to transfer the repository onto a portable device for example or for archival purposes. In this blog post we will go over how to bundle and unbundle a repository.
Clone the repo you want to bundle
git clone --mirror [email protected]:username/nameOfRepo.git
Bundle the repository using git
git bundle create nameOfRepo-bundle --all
Unbundle the bundled repository
mkdir repo-tmp
cp -Rp nameOfRepo-bundle ./repo-tmp/
cd repo-tmp
git config core.bare false //Repo will have a working directory
git reset --hard //Only use this command if you know what you are doing. This will get rid of changes that have not been committed. It will match your files with a particular commit.