1d1054faa6
Added -z option to git-annex commands that use --batch, useful for supporting filenames containing newlines. It only controls input to --batch, the output will still be line delimited unless --json or etc is used to get some other output. While git often makes -z affect both input and output, I don't like trying them together, and making it affect output would have been a significant complication, and also git-annex output is generally not intended to be machine parsed, unless using --json or a format option. Commands that take pairs like "file key" still separate them with a space in --batch mode. All such commands take care to support filenames with spaces when parsing that, so there was no need to change it, and it would have needed significant changes to the batch machinery to separate tose with a null. To make fromkey and registerurl support -z, I had to give them a --batch option. The implicit batch mode they enter when not provided with input parameters does not support -z as that would have complicated option parsing. Seemed better to move these toward using the same --batch as everything else, though the implicit batch mode can still be used. This commit was sponsored by Ole-Morten Duesund on Patreon.
109 lines
2.7 KiB
Markdown
109 lines
2.7 KiB
Markdown
# NAME
|
|
|
|
git-annex add - adds files to the git annex
|
|
|
|
# SYNOPSIS
|
|
|
|
git annex add `[path ...]`
|
|
|
|
# DESCRIPTION
|
|
|
|
Adds the specified files to the annex. If a directory is specified,
|
|
acts on all files inside the directory and its subdirectories.
|
|
If no path is specified, adds files from the current directory and below.
|
|
|
|
Files that are already checked into git and are unmodified, or that
|
|
git has been configured to ignore will be silently skipped.
|
|
|
|
If annex.largefiles is configured, and does not match a file,
|
|
`git annex add` will behave the same as `git add` and add the
|
|
non-large file directly to the git repository, instead of to the annex.
|
|
|
|
Large files are added to the annex in locked form, which prevents further
|
|
modification of their content unless unlocked by [[git-annex-unlock]](1).
|
|
(This is not the case however when a repository is in a filesystem not
|
|
supporting symlinks, or is in direct mode.)
|
|
To add a file to the annex in unlocked form, `git add` can be used instead
|
|
(that only works when the repository has annex.version 6 or higher).
|
|
|
|
This command can also be used to add symbolic links, both symlinks to
|
|
annexed content, and other symlinks.
|
|
|
|
# OPTIONS
|
|
|
|
* `--include-dotfiles`
|
|
|
|
Dotfiles are skipped unless explicitly listed, or unless this option is
|
|
used.
|
|
|
|
* `--force`
|
|
|
|
Add gitignored files.
|
|
|
|
* `--backend`
|
|
|
|
Specifies which key-value backend to use.
|
|
|
|
* file matching options
|
|
|
|
Many of the [[git-annex-matching-options]](1)
|
|
can be used to specify files to add.
|
|
|
|
For example: `--largerthan=1GB`
|
|
|
|
* `--jobs=N` `-JN`
|
|
|
|
Adds multiple files in parallel. This may be faster.
|
|
For example: `-J4`
|
|
|
|
* `--update` `-u`
|
|
|
|
Like `git add --update`, this does not add new files, but any updates
|
|
to tracked files will be added to the index.
|
|
|
|
* `--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.
|
|
|
|
* `--batch`
|
|
|
|
Enables batch mode, in which a file to add is read in a line from stdin,
|
|
the file is added, and repeat.
|
|
|
|
Note that if a file is skipped (due to not existing, being gitignored,
|
|
already being in git, or doesn't meet the matching options),
|
|
an empty line will be output instead of the normal output produced
|
|
when adding a file.
|
|
|
|
* `-z`
|
|
|
|
Makes the `--batch` input be delimited by nulls instead of the usual
|
|
newlines.
|
|
|
|
# SEE ALSO
|
|
|
|
[[git-annex]](1)
|
|
|
|
[[git-annex-unlock]](1)
|
|
|
|
[[git-annex-lock]](1)
|
|
|
|
[[git-annex-undo]](1)
|
|
|
|
[[git-annex-import]](1)
|
|
|
|
[[git-annex-unannex]](1)
|
|
|
|
[[git-annex-reinject]](1)
|
|
|
|
# AUTHOR
|
|
|
|
Joey Hess <id@joeyh.name>
|
|
|
|
Warning: Automatically converted into a man page by mdwn2man. Edit with care.
|