I usually use the command below inside my project.git
to get an archive in the specified destinations:
git archive master | tar -x -C /home/kave/site/
I wonder if its possible to archive directly from a remote repository instead into a destination directory?
I tried something like this, without any joy:
git archive master https://[email protected]/myoproject.git | tar -x -C /home/kave/site/
Any suggestions? Thanks
To archive a repository, go to your Repository Settings Page and click Archive this repository. Before archiving your repository, make sure you've changed its settings and consider closing all open issues and pull requests.
The git pull command is used to fetch and download content from a remote repository and immediately update the local repository to match that content. Merging remote upstream changes into your local repository is a common task in Git-based collaboration work flows.
The git archive command is a Git command line utility that will create an archive file from specified Git Refs like, commits, branches, or trees.
Well, there is no such option like archiving branches in git. But we can create a tag with a prefix like “archive”. In other words, we move entry about the feature from branch list to tags list. To restore the branch, checkout it by the tag.
From git help archive
:
--remote=<repo> Instead of making a tar archive from the local repository, retrieve a tar archive from a remote repository.
Command should end up like:
$ git archive --remote=https://[email protected]/myoproject.git master
But, if you would just extract the repo, you can make a shallow clone using --depth
parameter of git clone
:
--depth <depth> Create a shallow clone with a history truncated to the specified number of revisions. A shallow repository has a number of limitations (you cannot clone or fetch from it, nor push from nor into it), but is adequate if you are only interested in the recent history of a large project with a long history, and would want to send in fixes as patches.
So you have something like this:
$ git clone --depth=1 https://[email protected]/myoproject.git
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