Archive or clone specific files/directories with git (specifically github)
I’m trying to make a customizer similar to the one used by Twitter for their Bootstrap framework (http://twitter.github.com/bootstrap/customize.html). I have a github repo that I need to be able to specify certain files and directories to download as a zip.
I’ve looked into possible solutions, and have a few ideas on how I can accomplish this. But I’d like some feedback.
- How to zip git branch?
- Github download folder as zip
- Github release zip containing only partial code from repo
- zip or tar the resulting files with command “git status” over modified files. Linux
- Why does Zipping the same content twice gives two files with different SHA1?
- How do you pass a file list to the linux zip command
git archive will not work because the repo is on github and apparently they do not allow this. Also, I’ve not been able to find a way to specify files to include or exclude in the command itself.
My first thought was to create a script that clones the repo into a temporary directory and then delete the files I don’t want in the zip (including git files). The problem with this is I’d always be downloading everything — even the stuff I don’t want in the zip.
My other idea is to have a list of files to download and a script that loops through that list to get the files from raw.github.com.
What is the best way to do this? Does anyone know how Twitter accomplishes this for Bootstrap?
EDIT: Just to be clear, I’m not trying to create my own custom builder for Bootstrap; I have my own, unrelated project on github.
One Solution collect form web for “Archive or clone specific files/directories with git (specifically github)”
I contacted Jacob Thorton, one of the developers of Bootstrap, and he pointed me in the direction of the GitHub repo for their Heroku-hosted server-side process that creates the ZIP. (See Ivan Zuzak’s comment in the question.)
For anyone who stumbles upon this question, you can find it here: https://github.com/twitter/bootstrap-server
They are doing what I (and Ivan) suspected: getting the raw files from http://raw.github.com and creating the ZIP from that.