# run command inside the root directory of the project to bundle including all branches
git bundle create reponame.bundle --all
# to bundle only the main branch
git bundle create reponame.bundle main
# to unbundle, use the following command
git clone reponame.bundle
# after cloning, you will see the bundle is set as default remote repository origin
git remote -v
> origin /home/user/projects/reponame.bundle (fetch)
> origin /home/user/projects/reponame.bundle (push)
# if you want to add a new remote repo as origin, you first have to remove the current origin repository, but this means loosing access to your branches etc.
git remote rm origin
# alternatively, you can provide a new name while cloning
git clone --origin <new_name> reponame.bundle