I have my Darktable photo library in git-annex and I need to use
- .gitignore to ignore some files like *.lock
- .gitattributes to make the sidecar .xmp files to be non-annexed normal files (faster and saves the editing history)
What is the correct way to add those dotfiles to git in direct mode? Do I need to switch the repository to indirect mode and then back to direct mode? (I rather not do that very often since the repo has tens of thousands of files.)
The best way is to make your .gitattributes file configure annex.largefiles to not match the files or file extensions that you want to not be annexed. (Including the .gitattributes file itself.)
There are also ways to temporarily override annex.largefiles if you want to add a single file to git. Although this can be messy to need to remember if you later modify that file and are adding it again. Configuring annex.largefiles is better.
See https://git-annex.branchable.com/tips/largefiles
Ok, this seems to work: