I am using git on a relatively small project and I find that zipping the .git directory\'s contents might be a fine way to back up the project. But this is kind of weird bec
came to this question via google.
Here is what i did in the simplest way.
git checkout branch_to_clone
then create a new git branch from this branch
git checkout -b new_cloned_branch
Switched to branch 'new_cloned_branch'
come back to original branch and continue:
git checkout branch_to_clone
Assuming you screwed up and need to restore something from backup branch :
git checkout new_cloned_branch -- <filepath> #notice the space before and after "--"
Best part if anything is screwed up, you can just delete the source branch and move back to backup branch!!
Found the simple official way after wading through the walls of text above that would make you think there is none.
Create a complete bundle with:
$ git bundle create <filename> --all
Restore it with:
$ git clone <filename> <folder>
This operation is atomic AFAIK. Check official docs for the gritty details.
Regarding "zip": git bundles are compressed and surprisingly small compared to the .git folder size.