Using sparse-checkout to work on part of a git project
While working on redesigning this site, I thought that it would be nice if I could have a repository dedicated only to handling blog posts. Search led me to git sparse checkout:
- Initialize a git repository
$ git init <name> - Configure to enable sparse checkouts:
$ git config core.sparsecheckout true - Edit
.git/info/sparse-checkoutto include the target file or directory.$ echo target/directory/or/file >> .git/info/sparse-checkout - Add remote:
$ git remote add -f origin https//github.com/my_github/project.git - Fetch the files
$ git pull origin master
The resulting git repository should contain only the directory or file specified in .git/info/sparse-checkout (In the case above, target/directory/or/file).
Now if I could make something like an export template for exporting org subtrees as jekyll post file, it would make these blog posts so much easier to make.