git-annex/doc/git-annex-migrate.mdwn
Joey Hess 86dbe9a825
migrate: support adding size back to URL keys
migrate: Support adding size to URL keys that were added with --relaxed, by
running eg: git-annex migrate --backend=URL foo

Since url keys cannot be generated, that used to fail. Make it notice that
the backend is not changed, and just get the size of the content.

Sponsored-by: Brock Spratlen on Patreon
2023-12-08 16:22:14 -04:00

111 lines
3.3 KiB
Markdown

# NAME
git-annex migrate - switch data to different backend
# SYNOPSIS
git annex migrate `[path ...]`
git annex migrate --update
# DESCRIPTION
Changes the specified annexed files to use the default key-value backend
(or the one specified with `--backend`). Only files whose content
is currently present are migrated.
Note that the content is also still stored using the old keys after
migration. When possible, hard links are used to avoid that taking up
extra disk space. Use `git annex unused` to find and remove the old keys.
Normally, nothing will be done to specified files that are already using
the new backend. However, if a backend changes the information it uses to
construct a key, this can also be used to migrate files to use the new key
format.
# OPTIONS
* `--update`
This updates the local repository for migrations that were performed
elsewhere. Only new migrations since the last time this was run will
be performed.
This does not modify the working tree, but only hard links
(or in some cases copies) annex objects to their new keys.
`git-annex pull` and `git-annex sync --content` automatically do this,
unless the `annex.syncmigrations` config is set to false.
Note that older versions of git-annex did not record migrations in a
way that this can use. Migrations performed with those older versions
had to be manually run in each clone of the repository.
* `--apply`
This applies all recorded migrations to the local repository. It is the
non-incremental form of `--update`.
One situation where this can be useful is when `git-annex migrate
--update` has been run, but since then un-migrated
objects have entered the repository. Using this option ensures that
any such objects get migrated.
Note that older versions of git-annex did not record migrations in a
way that this can use. Migrations performed with those older versions
had to be manually run in each clone of the repository.
* `--backend`
Specify the new key-value backend to use for migrated data.
* `--force`
Force migration of keys that are already using the new backend.
* file matching options
The [[git-annex-matching-options]](1)
can be used to specify files to migrate.
* Also the [[git-annex-common-options]](1) can be used.
* `--remove-size`
Keys often include the size of their content, which is generally a useful
thing. In fact, this command defaults to adding missing size information
to keys. With this option, the size information is removed instead.
One use of this option is to convert URL keys that were added
by `git-annex addurl --fast` to ones that would have been added if
that command was run with the `--relaxed` option. Eg:
git-annex migrate --remove-size --backend=URL somefile
To add back the size to an URL key, use this:
git-annex migrate --backend=URL somefile
* `--json`
Enable JSON output. This is intended to be parsed by programs that use
git-annex. Each line of output is a JSON object.
* `--json-error-messages`
Messages that would normally be output to standard error are included in
the JSON instead.
# SEE ALSO
[[git-annex]](1)
[[git-annex-upgrade]](1)
[[git-annex-backend]](1)
# AUTHOR
Joey Hess <id@joeyh.name>
Warning: Automatically converted into a man page by mdwn2man. Edit with care.