0

With git lfs it is possible to register a file type as lockable, without using LFS. From the lfs wiki page:

If you'd like to register a file type as lockable, without using LFS, you can edit the .gitattributes file directly:

*.yml lockable

Once file patterns in .gitattributes are lockable, Git LFS will make them readonly on the local file system automatically. This prevents users from accidentally editing a file without locking it first.

I would like to do this for *.sql files, but when I do this, and run

git lfs ls-files

sql files are not returned.

Is there a way to ls-files that can be locked?

Simon
  • 422
  • 5
  • 19

1 Answers1

1

Git LFS doesn't provide a built-in way to do this. However, you can ask Git to do this for you by using git check-attr:

git ls-files | git check-attr --stdin lockable | awk -F': ' '$3 ~ /set/ { print $1 }'

This prints all files in the repository with the lockable attribute set.

bk2204
  • 64,793
  • 6
  • 84
  • 100