doc updated for import tree

Deprecated git annex export --tracking because it makes sense to have a
single configuration of tracking for both imports and exports.
This commit is contained in:
Joey Hess 2019-02-23 15:46:03 -04:00
parent 464485bffe
commit 5bac8babdb
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 109 additions and 35 deletions

View file

@ -6,8 +6,6 @@ git-annex export - export content to a remote
git annex export `treeish --to remote` git annex export `treeish --to remote`
git annex export `--tracking treeish --to remote`
# DESCRIPTION # DESCRIPTION
Use this command to export a tree of files from a git-annex repository. Use this command to export a tree of files from a git-annex repository.
@ -45,6 +43,16 @@ paragraph do not apply. Note that dropping content from such a remote is
not supported. See individual special remotes' documentation for not supported. See individual special remotes' documentation for
details of how to enable such versioning. details of how to enable such versioning.
The `git annex sync --content` command (and the git-annex assistant)
can also be used to export a branch to a special remote,
updating the special remote whenever the branch is changed.
To do this, you need to configure "remote.<name>.annex-tracking-branch"
to tell it what branch to track.
For example:
git config remote.myremote.annex-tracking-branch master
git annex sync --content
# OPTIONS # OPTIONS
* `--to=remote` * `--to=remote`
@ -53,13 +61,9 @@ details of how to enable such versioning.
* `--tracking` * `--tracking`
This makes the export track changes that are committed to This is a deprecated way to set "remote.<name>.annex-tracking-branch".
the branch. `git annex sync --content` and the git-annex assistant Instead of using this option, you should just set the git configuration
will update exports with commits made to the branch. yourself.
This is a local configuration setting, similar to a git remote's tracking
branch. You'll need to run `git annex export --tracking` in each
repository you want the export to track.
* `--fast` * `--fast`
@ -69,28 +73,24 @@ details of how to enable such versioning.
# EXAMPLE # EXAMPLE
git annex initremote myexport type=directory directory=/mnt/myexport \ git annex initremote myremote type=directory directory=/mnt/myremote \
exporttree=yes encryption=none exporttree=yes encryption=none
git annex export master --to myexport git annex export master --to myremote
After that, /mnt/myexport will contain the same tree of files as the master After that, /mnt/myremote will contain the same tree of files as the master
branch does. branch does.
git mv myfile subdir/myfile git mv myfile subdir/myfile
git commit -m renamed git commit -m renamed
git annex export master --to myexport git annex export master --to myremote
That updates /mnt/myexport to reflect the renamed file. That updates /mnt/myremote to reflect the renamed file.
git annex export master:subdir --to myexport git annex export master:subdir --to myremote
That updates /mnt/myexport, to contain only the files in the "subdir" That updates /mnt/myremote, to contain only the files in the "subdir"
directory of the master branch. directory of the master branch.
git annex export --tracking master --to myexport
That makes myexport track changes that are committed to the master branch.
# EXPORT CONFLICTS # EXPORT CONFLICTS
If two different git-annex repositories are both exporting different trees If two different git-annex repositories are both exporting different trees
@ -116,6 +116,8 @@ export`, it will detect the export conflict, and resolve it.
[[git-annex-initremote]](1) [[git-annex-initremote]](1)
[[git-annex-import]](1)
[[git-annex-sync]](1) [[git-annex-sync]](1)
# HISTORY # HISTORY

View file

@ -1,16 +1,71 @@
# NAME # NAME
git-annex import - move and add files from outside git working copy git-annex import - add files from a directory or special remote
# SYNOPSIS # SYNOPSIS
git annex import `[path ...]` git annex import `[path ...]` | git annex import branch[:subdir] --from remote
# DESCRIPTION # DESCRIPTION
Moves files from somewhere outside the git working copy, and adds them to This command is a way to import files from elsewhere into your git-annex
the annex. Individual files to import can be specified. repository. It can import files from a directory into your repository,
If a directory is specified, the entire directory is imported. or it can import files from a git-annex special remote.
## IMPORTING FROM A SPECIAL REMOTE
Importing from a special remote first downloads all new content from it,
and then constructs a git commit that reflects files that have changed on
the special remote since the last time git-annex looked at it. Merging that
commit into your repository will update it to reflect changes made on the
special remote.
This way, something can be using the special remote for file storage,
adding files, modifying files, and deleting files, and you can track those
changes using git-annex.
This can only be used with special remotes that were configured with
`importtree=yes` when set up with [[git-annex-initremote]](1). Only some
kinds of special remotes will let you configure them this way.
To import from a special remote, you must specify the name of a branch.
A corresponding remote tracking branch will be updated by `git annex
import`. After that point, it's the same as if you had run a `git fetch`
from a regular git remote; you can `git merge` the changes into your
currently checked out branch.
For example:
git annex import master --from myremote
git merge myremote/master
It's also posible to limit the import to a subdirectory, using the
"branch:subdir" syntax. For example, if "camera" is a special remote
that accesses a camera, and you want to import those into the photos
directory, rather than to the root of your repository:
git annex import master:photos --from camera
git merge camera/master
You can combine using `git annex import` to fetch changes from a special
remote with `git annex export` to send your local changes to the special
remote.
The `git annex sync --content` command (and the git-annex assistant)
can also be used to import from a special remote.
To do this, you need to configure "remote.<name>.annex-tracking-branch"
to tell it what branch to track. For example:
git config remote.myremote.annex-tracking-branch master
git annex sync --content
## IMPORTING FROM A DIRECTORY
When run with a path, `git annex import` moves files from somewhere outside
the git working copy, and adds them to the annex.
Individual files to import can be specified. If a directory is specified,
the entire directory is imported.
git annex import /media/camera/DCIM/* git annex import /media/camera/DCIM/*
@ -25,9 +80,11 @@ a new filename being added to the repository, so the duplicate file
is present in the repository twice. (With all checksumming backends, is present in the repository twice. (With all checksumming backends,
including the default SHA256E, only one copy of the data will be stored.) including the default SHA256E, only one copy of the data will be stored.)
Several options can be used to adjust handling of duplicate files. Several options can be used to adjust handling of duplicate files, see
`--duplicate`, `--deduplicate`, `--skip-duplicates`, `--clean-duplicates`,
and `--reinject-duplicates` documentation below.
# OPTIONS # OPTIONS FOR IMPORTING FROM A DIRECTORY
* `--duplicate` * `--duplicate`
@ -71,6 +128,8 @@ Several options can be used to adjust handling of duplicate files.
git annex import /dir --include='*.png' git annex import /dir --include='*.png'
## COMMON OPTIONS
* `--jobs=N` `-JN` * `--jobs=N` `-JN`
Imports multiple files in parallel. This may be faster. Imports multiple files in parallel. This may be faster.

View file

@ -82,9 +82,12 @@ by running "git annex sync" on the remote.
This behavior can be overridden by configuring the preferred content This behavior can be overridden by configuring the preferred content
of a repository. See [[git-annex-preferred-content]](1). of a repository. See [[git-annex-preferred-content]](1).
When a special remote is configured as an export and is tracking a branch, When `remote.<name>.annex-tracking-branch` is configured for a special remote
the export will be updated to the current content of the branch. and that branch is checked out, syncing will import changes from
See [[git-annex-export]](1). the remote, merge them into the branch, and export any changes that have
been committed to the branch back to the remote. See
See [[git-annex-import]](1) and [[git-annex-export]](1) for details about
how importing and exporting work.
* `--content-of=path` `-C path` * `--content-of=path` `-C path`

View file

@ -1266,13 +1266,23 @@ Here are all the supported configuration settings.
in some edge cases, where it's likely the case than an in some edge cases, where it's likely the case than an
object was downloaded incorrectly, or when needed for security. object was downloaded incorrectly, or when needed for security.
* `remote.<name>.annex-tracking-branch`
When set to eg, "master", this tells git-annex that you want the
special remote to track that branch.
When set to eg, "master:subdir", the special remote tracks only
the subdirectory of that branch.
`git-annex sync --content` and the git-annex assistant will
import changes from the remote and merge them into the
annex-tracking-branch. They also export changes made to the branch to the
remote.
* `remote.<name>.annex-export-tracking` * `remote.<name>.annex-export-tracking`
When set to a branch name or other treeish, this makes what's exported Deprecated name for `remote.<name>.annex-tracking-branch`. Will still be used
to the special remote track changes to the branch. See if it's configured and `remote.<name>.annex-tracking-branch` is not.
[[git-annex-export]](1). `git-annex sync --content` and the
git-annex assistant update exports when changes have been
committed to the tracking branch.
* `remote.<name>.annexUrl` * `remote.<name>.annexUrl`