I have a project I am working on that is currently on in a repository on my GitHub.
I am doing as a part of my degree, I will be shortly handing it over to the client
I was wondering if there is a way to export the entire repository including all the branches and related history so that it can be stored prior to handing on to future developer?
The "clone" command downloads an existing Git repository to your local computer. You will then have a full-blown, local version of that Git repo and can start working on the project.
(1) Use git archive (for backup one branch) like the below command (Suppose you are inside Git local repository):
git archive master --format=zip --output=java_exmamples.zip
you will see file java_exmamples.zip
(in the same folder) is the backup of master branch.
(2) Use git bundle (for backup all branches)
A real example:
git clone --mirror https://github.com/donhuvy/java_examples.git
cd java_examples.git/
git bundle create repo.bundle --all
repo.bundle
is the file what you need (full back up) in the same directory.
How to restore from file repo.bundle
:
git clone repo.bundle
Reference
https://git-scm.com/docs/git-archive
https://git-scm.com/docs/git-bundle
http://rypress.com/tutorials/git/tips-and-tricks#bundle-the-repository
Beside forking it (which is a clone on the remote side: GitHub), you can also export it as a bundle.
From your own local clone, you can type (using git bundle
)
git bundle create /tmp/myrepo.bundle --all
That will give you one file (easy to copy around), from which you can clone back your repo at any time.
cd /a/new/path
git clone /tmp/myrepo.bundle myrepo
cd myrepo
pwd
/a/new/path/myrepo
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With