2015-03-23 19:36:10 +00:00
|
|
|
# NAME
|
|
|
|
|
|
|
|
git-annex add - adds files to the git annex
|
|
|
|
|
|
|
|
# SYNOPSIS
|
|
|
|
|
|
|
|
git annex add `[path ...]`
|
|
|
|
|
|
|
|
# DESCRIPTION
|
|
|
|
|
2016-01-19 21:46:46 +00:00
|
|
|
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.
|
2015-03-23 19:36:10 +00:00
|
|
|
|
2015-12-15 18:07:54 +00:00
|
|
|
Files that are already checked into git and are unmodified, or that
|
|
|
|
git has been configured to ignore will be silently skipped.
|
2015-03-23 19:36:10 +00:00
|
|
|
|
2023-06-12 20:30:21 +00:00
|
|
|
If annex.largefiles is configured (in git config, gitattributes, or
|
|
|
|
git-annex config), 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. (By default dotfiles are assumed to
|
|
|
|
not be large, and are added directly to git, but annex.dotfiles can be
|
|
|
|
configured to annex those too.) See the git-annex manpage for documentation
|
|
|
|
of these and other configuration settings.
|
|
|
|
|
|
|
|
By default, large files are added to the annex in locked form, which
|
|
|
|
prevents further modification of their content until
|
|
|
|
unlocked by [[git-annex-unlock]](1). (This is not the case however
|
|
|
|
when a repository is in a filesystem not supporting symlinks.)
|
|
|
|
The annex.addunlocked git config (and git-annex config) can be used to
|
|
|
|
change this behavior.
|
2015-12-15 18:07:54 +00:00
|
|
|
|
2015-12-15 18:14:19 +00:00
|
|
|
This command can also be used to add symbolic links, both symlinks to
|
|
|
|
annexed content, and other symlinks.
|
2015-07-07 20:15:30 +00:00
|
|
|
|
2020-05-12 13:07:45 +00:00
|
|
|
# EXAMPLES
|
|
|
|
|
|
|
|
# git annex add foo bar
|
|
|
|
add foo ok
|
|
|
|
add bar ok
|
|
|
|
# git commit -m added
|
|
|
|
|
2015-03-23 19:36:10 +00:00
|
|
|
# OPTIONS
|
|
|
|
|
Added --no-check-gitignore option for finer grained control than using --force.
add, addurl, importfeed, import: Added --no-check-gitignore option
for finer grained control than using --force.
(--force is used for too many different things, and at least one
of these also uses it for something else. I would like to reduce
--force's footprint until it only forces drops or a few other data
losses. For now, --force still disables checking ignores too.)
addunused: Don't check .gitignores when adding files. This is a behavior
change, but I justify it by analogy with git add of a gitignored file
adding it, asking to add all unused files back should add them all back,
not skip some. The old behavior was surprising.
In Command.Lock and Command.ReKey, CheckGitIgnore False does not change
behavior, it only makes explicit what is done. Since these commands are run
on annexed files, the file is already checked into git, so git add won't
check ignores.
2020-09-18 17:12:04 +00:00
|
|
|
* `--no-check-gitignore`
|
2015-03-23 19:36:10 +00:00
|
|
|
|
|
|
|
Add gitignored files.
|
|
|
|
|
2020-01-01 18:03:06 +00:00
|
|
|
* `--force-large`
|
|
|
|
|
2020-01-01 18:26:43 +00:00
|
|
|
Treat all files as large files, ignoring annex.largefiles and annex.dotfiles
|
|
|
|
configuration, and add to the annex.
|
2020-01-01 18:03:06 +00:00
|
|
|
|
|
|
|
* `--force-small`
|
|
|
|
|
2020-01-01 18:26:43 +00:00
|
|
|
Treat all files as small files, ignoring annex.largefiles and annex.dotfiles
|
2020-10-26 15:12:17 +00:00
|
|
|
and annex.addsmallfiles configuration, and add to git.
|
2020-01-01 18:03:06 +00:00
|
|
|
|
2015-03-23 19:36:10 +00:00
|
|
|
* `--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`
|
|
|
|
|
2015-11-05 22:24:15 +00:00
|
|
|
* `--jobs=N` `-JN`
|
|
|
|
|
|
|
|
Adds multiple files in parallel. This may be faster.
|
|
|
|
For example: `-J4`
|
|
|
|
|
2019-05-10 17:24:31 +00:00
|
|
|
Setting this to "cpus" will run one job per CPU core.
|
|
|
|
|
2017-04-07 19:55:34 +00:00
|
|
|
* `--update` `-u`
|
|
|
|
|
|
|
|
Like `git add --update`, this does not add new files, but any updates
|
|
|
|
to tracked files will be added to the index.
|
|
|
|
|
2022-08-03 15:16:04 +00:00
|
|
|
* `--dry-run`
|
|
|
|
|
|
|
|
Output what would be done for each file, but avoid making any changes.
|
|
|
|
|
2016-01-19 15:54:13 +00:00
|
|
|
* `--json`
|
|
|
|
|
|
|
|
Enable JSON output. This is intended to be parsed by programs that use
|
2023-04-25 21:37:34 +00:00
|
|
|
git-annex. Each line of output is a JSON object.
|
2016-01-19 15:54:13 +00:00
|
|
|
|
2019-06-25 17:12:47 +00:00
|
|
|
* `--json-progress`
|
|
|
|
|
|
|
|
Include progress objects in JSON output.
|
|
|
|
|
2018-02-19 18:28:17 +00:00
|
|
|
* `--json-error-messages`
|
|
|
|
|
2023-04-25 21:37:34 +00:00
|
|
|
Messages that would normally be output to standard error are included in
|
|
|
|
the JSON instead.
|
2018-02-19 18:28:17 +00:00
|
|
|
|
2016-01-19 21:46:46 +00:00
|
|
|
* `--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,
|
make --batch honor matching options
When --batch is used with matching options like --in, --metadata, etc, only
operate on the provided files when they match those options. Otherwise, a
blank line is output in the batch protocol.
Affected commands: find, add, whereis, drop, copy, move, get
In the case of find, the documentation for --batch already said it honored
the matching options. The docs for the rest didn't, but it makes sense to
have them honor them. While this is a behavior change, why specify the
matching options with --batch if you didn't want them to apply?
Note that the batch output for all of the affected commands could
already output a blank line in other cases, so batch users should
already be prepared to deal with it.
git-annex metadata didn't seem worth making support the matching options,
since all it does is output metadata or set metadata, the use cases for
using it in combination with the martching options seem small. Made it
refuse to run when they're combined, leaving open the possibility for later
support if a use case develops.
This commit was sponsored by Brett Eisenberg on Patreon.
2018-08-08 16:03:30 +00:00
|
|
|
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.
|
2016-01-19 21:46:46 +00:00
|
|
|
|
added -z
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.
2018-09-20 20:09:21 +00:00
|
|
|
* `-z`
|
|
|
|
|
|
|
|
Makes the `--batch` input be delimited by nulls instead of the usual
|
|
|
|
newlines.
|
|
|
|
|
2021-05-10 19:00:13 +00:00
|
|
|
* Also the [[git-annex-common-options]](1) can be used.
|
|
|
|
|
2015-03-23 19:36:10 +00:00
|
|
|
# SEE ALSO
|
|
|
|
|
|
|
|
[[git-annex]](1)
|
|
|
|
|
2015-05-29 16:12:55 +00:00
|
|
|
[[git-annex-unlock]](1)
|
|
|
|
|
|
|
|
[[git-annex-lock]](1)
|
|
|
|
|
|
|
|
[[git-annex-undo]](1)
|
|
|
|
|
|
|
|
[[git-annex-import]](1)
|
|
|
|
|
|
|
|
[[git-annex-unannex]](1)
|
|
|
|
|
|
|
|
[[git-annex-reinject]](1)
|
|
|
|
|
2015-03-23 19:36:10 +00:00
|
|
|
# AUTHOR
|
|
|
|
|
|
|
|
Joey Hess <id@joeyh.name>
|
|
|
|
|
|
|
|
Warning: Automatically converted into a man page by mdwn2man. Edit with care.
|