1git-annex-sync(1) General Commands Manual git-annex-sync(1)
2
3
4
6 git-annex-sync - synchronize local repository with remotes
7
9 git annex sync [remote ...]
10
12 This command synchronizes the local repository with its remotes.
13
14 The sync process involves first committing any local changes to files
15 that have previously been added to the repository, then fetching and
16 merging the current branch and the git-annex branch from the remote
17 repositories, and finally pushing the changes back to those branches on
18 the remote repositories. You can use standard git commands to do each
19 of those steps by hand, or if you don't want to worry about the
20 details, you can use sync.
21
22 The content of annexed objects is not synced by default, but the --con‐
23 tent option (see below) can make that also be synchronized.
24
25 When using git-annex, often remotes are not bare repositories, because
26 it's helpful to add remotes for nearby machines that you want to access
27 the same annexed content. Syncing with a non-bare remote will not nor‐
28 mally update the remote's current branch with changes from the local
29 repository. (Unless the remote is configured with receive.denyCurrent‐
30 Branch=updateInstead.)
31
32 To make working with such non-bare remotes easier, sync pushes not only
33 local master to remote master, but also to remote synced/master (and
34 similar with other branches). When git-annex sync is later run on the
35 remote, it will merge the synced/ branches that the repository has
36 received.
37
39 [remote]
40
41 By default, all remotes are synced, except for remotes that have
42 remote.<name>.annex-sync set to false. By specifying the names
43 of remotes (or remote groups), you can control which ones to
44 sync with.
45
46 --fast Only sync with the remotes with the lowest annex-cost value con‐
47 figured.
48
49 When a list of remotes (or remote groups) is provided, it picks
50 from amoung those, otherwise it picks from amoung all remotes.
51
52 --only-annex -a, --not-only-annex
53 Only sync the git-annex branch and annexed content with remotes,
54 not other git branches.
55
56 This avoids pulling and pushing other branches, and it avoids
57 committing any local changes. It's up to you to use regular git
58 commands to do that.
59
60 The annex.synconlyannex configuration can be set to true to make
61 this be the default behavior of git-annex sync. To override such
62 a setting, use --not-only-annex.
63
64 When this is combined with --no-content, only the git-annex
65 branch will be synced.
66
67 --commit, --no-commit
68 A commit is done by default (unless annex.autocommit is set to
69 false).
70
71 Use --no-commit to avoid committing local changes.
72
73 --message=msg
74 Use this option to specify a commit message.
75
76 --pull, --no-pull
77 By default, syncing pulls from remotes and imports from some
78 special remotes. Use --no-pull to disable all pulling.
79
80 When remote.<name>.annex-pull or remote.<name>.annex-sync are
81 set to false, pulling is disabled for those remotes, and using
82 --pull will not enable it.
83
84 --push, --no-push
85 By default, syncing pushes changes to remotes and exports to
86 some special remotes. Use --no-push to disable all pushing.
87
88 When remote.<name>.annex-push or remote.<name>.annex-sync are
89 set to false, or remote.<name>.annex-readonly is set to true,
90 pushing is disabled for those remotes, and using --push will not
91 enable it.
92
93 --content, --no-content
94 Normally, syncing does not transfer the contents of annexed
95 files. The --content option causes the content of annexed files
96 to also be uploaded and downloaded as necessary.
97
98 The annex.synccontent configuration can be set to true to make
99 content be synced by default.
100
101 Normally this tries to get each annexed file that is in the
102 working tree and whose content the local repository does not yet
103 have, and then copies each file to every remote that it is sync‐
104 ing with. This behavior can be overridden by configuring the
105 preferred content of a repository. See git-annex-preferred-con‐
106 tent(1).
107
108 When remote.<name>.annex-tracking-branch is configured for a
109 special remote and that branch is checked out, syncing with
110 --content will import changes from the remote, merge them into
111 the branch, and export any changes that have been committed to
112 the branch back to the remote. With --no-content, imports will
113 only be made from special remotes that support importing without
114 transferring files, and no exports will be done. See git-
115 annex-import(1) and git-annex-export(1) for details about how
116 importing and exporting work.
117
118 --content-of=path -C path
119 While --content operates on all annexed files, --content-of
120 allows limiting the transferred files to ones in a given loca‐
121 tion.
122
123 This option can be repeated multiple times with different paths.
124
125 --all -A
126 This option, when combined with --content, makes all available
127 versions of all files be synced, when preferred content settings
128 allow.
129
130 Note that preferred content settings that use include= or
131 exclude= will only match the version of files currently in the
132 work tree, but not past versions of files.
133
134 --jobs=N -JN
135 Enables parallel syncing with up to the specified number of jobs
136 running at once. For example: -J10
137
138 Setting this to "cpus" will run one job per CPU core.
139
140 When there are multiple git remotes, pushes will be made to them
141 in parallel. Pulls are not done in parallel because that tends
142 to be less efficient. When --content is synced, the files are
143 processed in parallel as well.
144
145 --resolvemerge, --no-resolvemerge
146 By default, merge conflicts are automatically handled by sync.
147 When two conflicting versions of a file have been committed,
148 both will be added to the tree, under different filenames. For
149 example, file "foo" would be replaced with "foo.variant-A" and
150 "foo.variant-B". (See git-annex-resolvemerge(1) for details.)
151
152 Use --no-resolvemerge to disable this automatic merge conflict
153 resolution. It can also be disabled by setting annex.resolve‐
154 merge to false.
155
156 --cleanup
157 Removes the local and remote synced/ branches, which were cre‐
158 ated and pushed by git-annex sync.
159
160 This can come in handy when you've synced a change to remotes
161 and now want to reset your master branch back before that
162 change. So you run git reset and force-push the master branch to
163 remotes, only to find that the next git annex merge or git annex
164 sync brings the changes back. Why? Because the synced/master
165 branch is hanging around and still has the change in it. Clean‐
166 ing up the synced/ branches prevents that problem.
167
169 git-annex(1)
170
171 git-annex-preferred-content(1)
172
174 Joey Hess <id@joeyh.name>
175
176 git-annex-sync(1)