You can use Dat alongside Git! Dat will store your data while Git stores your code.
In this example, we have an index.html as our code and cat pictures as our data. We check in our code and dat.json to Git while our data lives in a separate dat. You can view the whole Dat online.
- Use
dat createto create a new dat for your data - Add the
dat.jsonfile from your dat to git - (optional) Add
.datdownloadto specify which files users will download by default. - Add instructions, similar to below, on how to download data via dat.
View the cat picture data associated with this git repository:
npm install -g dat
- Clone this repository
- Open
index.htmlin a browser (you should see missing pictures) - Download the data via dat
- Refresh
index.htmland view cat pictures!
git clone https://github.com/joehand/dat-git-example.git
open ./dat-git-example/index.html
dat clone ./dat-git-example # download cat pictures & refresh!
Including the .datdownload folder, you can specify only certain files to be downloaded by default. Download the selective files with:
git clone https://github.com/joehand/dat-git-example.git
dat clone ./dat-git-example --empty
dat sync ./dat-git-example