You probably want something like the array variables from bash. You can find out more about them in the manpage, in the Arrays
section.
Since you are using sh, you don't have direct access to them. If you want to use them, change the shebang to #!/usr/bin/env bash
.
For the conversion to lossy, git smudge/clean filters might work. Afaik git-lfs works with them. In general git-lfs might be something interesting for your use case.