If I want to replace a locked file with new content, rather than edit the existing content, is it ok to skip the git-annex-unlock
/git-annex-lock
steps? If I just remove the symlink to the annex, create a new regular file in its place, then git-annex-add
the new file and commit, things seem to work fine. Does this create some inconsistency that can come back to bite me later, or is this supported usage?
It's not even necessary to delete the symlink, you can just rename the new version of the file over it.
Unlocking the file is only necessary if you want to edit it in place.
Unlocking a file does add a little bit of overhead. Mostly making a copy of it that is not needed when you're just going to overwrite it. Also the annex pointer gets added as a git object (which will get garbage collected eventually) and some minor things get stored to git-annex's internal database to keep track of it.