2013-09-07 23:18:16 +00:00
|
|
|
Notice that in the [[previous example|getting_file_content]], `git annex
|
|
|
|
sync` was used. This lets git-annex know what has changed in the other
|
|
|
|
repositories like the laptop, and so it knows about the files present there and can
|
2011-12-31 18:50:40 +00:00
|
|
|
get them.
|
|
|
|
|
2013-09-07 23:18:16 +00:00
|
|
|
Let's look at what the sync command does in more detail:
|
2011-12-31 18:50:40 +00:00
|
|
|
|
2019-03-27 15:15:03 +00:00
|
|
|
$ cd /media/usb/annex
|
|
|
|
$ git annex sync
|
2011-12-31 18:50:40 +00:00
|
|
|
commit
|
|
|
|
nothing to commit (working directory clean)
|
|
|
|
ok
|
|
|
|
pull laptop
|
|
|
|
ok
|
|
|
|
push laptop
|
|
|
|
ok
|
|
|
|
|
2014-02-02 20:21:42 +00:00
|
|
|
After you run sync, the git repository will be updated with all changes
|
|
|
|
made to its remotes, and any changes in the git repository will be pushed
|
|
|
|
out to its remotes, where a sync will get them. This is especially useful
|
|
|
|
when using git in a distributed fashion, without a [[central bare
|
|
|
|
repository|tips/centralized_git_repository_tutorial]]. See [[sync]] for
|
|
|
|
details.
|
2013-07-08 20:17:24 +00:00
|
|
|
|
2014-02-02 20:21:42 +00:00
|
|
|
By default `git annex sync` only syncs the metadata about your
|
git-annex pull and push
Split out two new commands, git-annex pull and git-annex push. Those plus a
git commit are equivilant to git-annex sync.
In a sense, git-annex sync conflates 3 things, and it would have been
better to have push and pull from the beginning and not sync. Although
note that git-annex sync --content is faster than a pull followed by a
push, because it only has to walk the tree once, look at preferred
content once, etc. So there is some value in git-annex sync in speed, as
well as user convenience.
And it would be hard to split out pull and push from sync, as far as the
implementaton goes. The implementation inside sync was easy, just adjust
SyncOptions so it does the right thing.
Note that the new commands default to syncing content, unless
annex.synccontent is explicitly set to false. I'd like sync to also do
that, but that's a hard transition to make. As a start to that
transition, I added a note to git-annex-sync.mdwn that it may start to
do so in a future version of git-annex. But a real transition would
necessarily involve displaying warnings when sync is used without
--content, and time.
Sponsored-by: Kevin Mueller on Patreon
2023-05-16 20:37:30 +00:00
|
|
|
files that is stored in git. It does not sync the contents of annexed
|
|
|
|
files, that are managed by git-annex. To do that, you can use
|
|
|
|
`git annex sync --content`
|
|
|
|
|
|
|
|
There are also commands `git-annex pull` and `git-annex push` that are like
|
|
|
|
`git-annex sync`, but only transfer in one direction, do not commit, and
|
|
|
|
operate on the content of annexed files by default.
|