git-annex-addgit-annexhttp://git-annex.branchable.com/git-annex-add/git-annexikiwiki2022-04-19T18:05:09Zannex.largefileshttp://git-annex.branchable.com/git-annex-add/comment_1_0e6b855afb4fba540ea5560df26839c5/AlbertZeyer2021-03-02T22:09:45Z2021-01-01T21:25:43Z
<p>Does annex.largefiles has some documentation? It would be nice to link to that on the doc of git-annex-add.</p>
<p>Esp, after reading this, I wonder about the default value of annex.largefiles. (I assume/hope it is disabled?)</p>
Adding external fileshttp://git-annex.branchable.com/git-annex-add/comment_2_43cf725964c63a2d2545d9f204316a57/AlbertZeyer2021-03-02T22:09:45Z2021-01-01T21:30:38Z
<p>Let's assume I have some external files in my <code>~/Pictures</code> and I want to import them.</p>
<p>Should I use <code>git annex import ~/Pictures/BestPics2020</code> or <code>cp -r ~/Pictures/BestPics2020 .; git annex add BestPics2020</code>? Is there a difference? Which way would be recommended or preferred?</p>
comment 3http://git-annex.branchable.com/git-annex-add/comment_3_8517f9634d217f731efd704405d3f2ca/Lukey2021-03-02T22:09:45Z2021-01-02T15:12:49Z
<p>The various configuration options are documented in the main <a href="http://git-annex.branchable.com/git-annex/">git-annex</a> manpage, at the bottom.</p>
<p>If it is a one-shot, just use <code>cp/mv</code> and <code>git annex add</code>. If you want to frequently import from that location, use directory special-remotes with importtree=yes.</p>
comment 4http://git-annex.branchable.com/git-annex-add/comment_4_3bbbe94633b6cb4ef93b7942eb36cc6c/AlbertZeyer2021-03-02T22:09:45Z2021-01-02T16:23:05Z
But is there a difference to <code>git annex import</code>? What is the difference? Why would you use <code>git annex add</code> instead of <code>git annex import</code>?
comment 5http://git-annex.branchable.com/git-annex-add/comment_5_f67bd5fdbe9deeeea1d48175a6b5c536/joey2021-03-02T22:09:45Z2021-01-04T17:34:56Z
<p>You use <code>git-annex add</code> when you have a file located
inside your git-annex repository, which you want to check in.</p>
<p>You use <code>git-annex import</code> when you have some other thing
storing files and you want git-annex to learn about the files stored there.
Using git-annex import to move individual files to the repository and add
them is not significantly different than mv+add and will eventually be
deprecated.</p>
recording state in githttp://git-annex.branchable.com/git-annex-add/comment_6_be9e67994aacebedb478f68a8ae542a5/lh2022-04-13T23:56:09Z2022-04-13T23:56:09Z
<p>Why does git-annex-add record state in Git? This means if you change your mind before committing and unannex some files, those files are still left in the annex. Semantically, this makes git-annex-add feel more like a commit operation, which is confusing given the name.</p>
<p>Furthermore, to forcibly drop these files, you have to take the output <code>git annex whereused --unused --historical</code> and compare it against the output of <code>git annex unused</code> to get a list of files that don't show up anywhere in the history. This is rather cumbersome for dropping files you never committed.</p>
<p>Couldn't the <code>git-annex</code> branch use the index, like git itself, so unannexing wouldn't leave you with extraneous files?</p>
<p>I get the safety perspective, but I feel like that's what <code>git commit</code> (and a hypothetical <code>git annex commit</code>) should be for. The staging area is useful to verify you're actually committing what you want. I know I'm probably a decade late here, but I'd be interested to hear your thoughts, anyway. It seems weird to deviate from git here.</p>
comment 7http://git-annex.branchable.com/git-annex-add/comment_7_bb9d72f90f4d3c93d71de1a1bbc244b6/joey2022-04-19T18:05:09Z2022-04-19T16:09:12Z
<p>@lh I don't feel this man page's comment section is the place to discuss
this in detail. But suffice to say that even if add behaved the way you
suggest, any other git-annex command can commit the accumulated changes
to the git-annex branch at any time. So the change would not guarantee
the behavior you hope for.</p>
<p>But, you can set annex.alwayscommit to false and run <code>git-annex merge</code>
when you do want to commit changes to the git-annex branch.</p>