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.)
To add a file to the annex in unlocked form, git add
can be used instead.
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
Setting this to "cpus" will run one job per CPU core.
--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-progress
Include progress objects in JSON output.
--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)
AUTHOR
Joey Hess id@joeyh.name
Warning: Automatically converted into a man page by mdwn2man. Edit with care.
Yes you can do that. Simplest way is to git add the files you want to directly be in the git repo (e.g. the source code) and git annex add the large files.
You can then check in any changes to the source code files (or anything else you added with git add) to github as normal.
You can manage the storage and versioning of the large files using git annex commands. Git annex supports using AWS S3 and/or glacier for backing up the files. It can also back them up to a server you control over ssh or to an external drive (or any combination of the above). http://git-annex.branchable.com/special_remotes/
With the latest version of git annex, you can also set up automatically filters that decide which types/sizes of files to check in directly to git vs which ones to store as links in the annex. https://git-annex.branchable.com/tips/largefiles/ For more tech related assistance or support Data Recovery Dubai
Because "git add foo" does not work in direct mode.
This is really not the place to be having a conversation about this. If you want something changed in git-annex, open a bug report or todo item.
That's fabulous. A Bash alias around that command is really all I need when working in direct mode. (And the archive's too damn big to switch back and forth between direct/indirect.)
I was just too much a newb with git attributes to know it could be done that way. For discoverability, maybe that command could be placed in an "examples" section in the primary documentation above?
@rrnewton I know people do commonly accomplish this by something like
git -c annex.largefiles='exclude(*)' annex add
A shorter way to write that would only be useful for direct mode, so I'm inclined not to add it, but open a todo item if you want to discuss that.
When in direct mode, the "add the non-large file directly to the git repository" behavior described above is very useful, because the option of typing simply
git add foo
, does not exist as it does in indirect mode.However, I can't see any combination of flags that trigger this behavior. I suppose it can be accomplished by temporarily setting annex.largefiles to a huge value before executing
git annex add
(i.e. creating a.gitattributes
and then deleting it). I think I'll try that as a work-around, but it would be great to have a flag that accomplishes this.