1git-annex-import(1)         General Commands Manual        git-annex-import(1)
2
3
4

NAME

6       git-annex-import  -  add files from a non-versioned directory or a spe‐
7       cial remote
8

SYNOPSIS

10       git  annex  import  [path  ...]  |  git  annex  import  --from   remote
11       branch[:subdir]
12

DESCRIPTION

14       This  command  is  a  way to import files from elsewhere into your git-
15       annex repository. It can import files from a directory into your repos‐
16       itory, or it can import files from a git-annex special remote.
17
18       ## IMPORTING FROM A SPECIAL REMOTE
19
20       Importing  from  a  special remote first downloads all new content from
21       it, and then constructs a git commit  that  reflects  files  that  have
22       changed  on  the special remote since the last time git-annex looked at
23       it. Merging that commit into your repository will update it to  reflect
24       changes made on the special remote.
25
26       This  way,  something can be using the special remote for file storage,
27       adding files, modifying files, and deleting files, and  you  can  track
28       those changes using git-annex.
29
30       You  can combine using git annex import to fetch changes from a special
31       remote with git annex export to send your local changes to the  special
32       remote.
33
34       You  can  only  import  from  special remotes that were configured with
35       importtree=yes when set  up  with  git-annex-initremote(1).  Only  some
36       kinds of special remotes will let you configure them this way.
37
38       To import from a special remote, you must specify the name of a branch.
39       A corresponding remote tracking branch will be  updated  by  git  annex
40       import.  After  that point, it's the same as if you had run a git fetch
41       from a regular git remote; you can git merge the changes into your cur‐
42       rently checked out branch.
43
44       For example:
45
46        git annex import master --from myremote
47        git merge myremote/master
48
49       Note  that  you  may need to pass --allow-unrelated-histories the first
50       time you git merge from an import. Think of this as the remote being  a
51       separate  git  repository  with  its  own files. If you first git annex
52       export files to a remote, and then git annex import from it, you  won't
53       need that option.
54
55       You can also limit the import to a subdirectory, using the "branch:sub‐
56       dir" syntax. For example, if "camera" is a special remote that accesses
57       a  camera,  and  you  want  to  import those into the photos directory,
58       rather than to the root of your repository:
59
60        git annex import master:photos --from camera
61        git merge camera/master
62
63       The git annex sync --content command (and the git-annex assistant)  can
64       also  be used to import from a special remote.  To do this, you need to
65       configure "remote.<name>.annex-tracking-branch" to tell it what  branch
66       to track. For example:
67
68        git config remote.myremote.annex-tracking-branch master
69        git annex sync --content
70
71       ## IMPORTING FROM A DIRECTORY
72
73       When  run with a path, git annex import moves files from somewhere out‐
74       side the git working copy, and adds them to the annex.
75
76       Individual files to import can be specified. If a directory  is  speci‐
77       fied, the entire directory is imported.
78
79        git annex import /media/camera/DCIM/*
80
81       When importing files, there's a possibility of importing a duplicate of
82       a file that is already known to git-annex  --  its  content  is  either
83       present  in the local repository already, or git-annex knows of another
84       repository that contains it, or it was present in the annex before  but
85       has been removed now.
86
87       By  default, importing a duplicate of a known file will result in a new
88       filename being added to  the  repository,  so  the  duplicate  file  is
89       present  in  the  repository  twice.  (With  all checksumming backends,
90       including the default SHA256E, only  one  copy  of  the  data  will  be
91       stored.)
92
93       Several  options can be used to adjust handling of duplicate files, see
94       --duplicate, --deduplicate, --skip-duplicates, --clean-duplicates,  and
95       --reinject-duplicates documentation below.
96

OPTIONS FOR IMPORTING FROM A DIRECTORY

98       --duplicate
99
100              Do not delete files from the import location.
101
102              Running  with  this  option repeatedly can import the same files
103              into different git repositories, or branches, or different loca‐
104              tions in a git repository.
105
106       --deduplicate
107              Only  import files that are not duplicates; duplicate files will
108              be deleted from the import location.
109
110       --skip-duplicates
111              Only import files that are not duplicates. Avoids  deleting  any
112              files from the import location.
113
114       --clean-duplicates
115              Does  not  import  any  files, but any files found in the import
116              location that are duplicates are deleted.
117
118       --reinject-duplicates
119              Imports files that are not duplicates. Files that are duplicates
120              have  their  content  reinjected into the annex (similar to git-
121              annex-reinject(1)).
122
123       --force
124              Allow existing files to be overwritten by newly imported files.
125
126              Also, causes .gitignore to not take effect when adding files.
127
128       file matching options
129              Many of the git-annex-matching-options(1) can be used to specify
130              files to import.
131
132                   git annex import /dir --include='*.png'
133
134              ## COMMON OPTIONS
135
136       --jobs=N -JN
137              Imports  multiple  files  in  parallel. This may be faster.  For
138              example: -J4
139
140       --json Enable JSON output. This is intended to be  parsed  by  programs
141              that use git-annex. Each line of output is a JSON object.
142
143       --json-error-messages
144              Messages  that  would  normally  be output to standard error are
145              included in the json instead.
146

CAVEATS

148       Note that using --deduplicate or --clean-duplicates with the WORM back‐
149       end does not look at file content, but filename and mtime.
150
151       If annex.largefiles is configured, and does not match a file, git annex
152       import will add the non-large file  directly  to  the  git  repository,
153       instead of to the annex.
154

SEE ALSO

156       git-annex(1)
157
158       git-annex-add(1)
159
160       git-annex-export(1)
161

AUTHOR

163       Joey Hess <id@joeyh.name>
164
165                                                           git-annex-import(1)
Impressum