summaryrefslogtreecommitdiff
path: root/doc/tips/replacing_Sparkleshare_or_dvcs-autosync_with_the_assistant.mdwn
blob: 893408c2fe65364707fa032e2edb7c6cbeb98c39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Sparkleshare and dvcs-autosync are tools to automatically commit your
changes to git and keep them in sync with other repositories. Unlike
git-annex, they don't store the file content on the side, but directly in
the git repository. Great for small files, less good for big files.

Here's how to use the [[git-annex assistant|/assistant]] to do the same
thing, but even better!

----

First, get git-annex version 4.20130329 or newer.

----

Let's suppose you're delveloping a video game, written in C. You have
source code, and some large game assets. You want to ensure the source
code is stored in git -- that's what git's for! And you want to store
the game assets in the git annex -- to avod bloating your git repos with
possibly enormous files, but still version control them.

All you need to do is configure git-annex to treat your C files
as small files. And treat any file larger than, say, 100kb as a large
file that is stored in the annex.

	git config annex.largefiles "largerthan=100kb and not (include=*.c or include=*.h)"

----

Now if you run `git annex add`, it will only add the large files to the
annex. You can `git add` the small files directly to git.

Note that in order to use `git add` on the small files, your repository
needs to be in indirect mode, rather than [[direct mode]]. If it's in
direct mode, `git add` will fail. You can fix that:

	git annex indirect

----

A less manual option is to run `git annex assistant`. It will *automatically*
add the large files to the annex, and store the small files in git.
It'll notice every time you modify a file, and immediately commit it,
too. And sync it out to other repositories you configure using `git annex
webapp`.

----

It's also possible to disable the use of the annex entirely, and just
have the assistant *always* put every file into git, no matter its size:

	git config annex.largefiles "exclude=*"