For a long time Git has had the gitattributes which is the starting point for the answer to this question. You can read more about it in the Git docs, here.
z/OS behaves a bit different in this aspect compared to what you will find in the documentation. There is a reason for it though. While the Git docs mention working-tree-encoding
you should be using zos-working-tree-encoding
to specify IBM-1047 instead. This was originally developed by Rocket but has since been taken over into other versions as well (see Mike's comment below). It is documented here: https://docs.rocketsoftware.com/bundle/openappdev_ug_20/page/brb1683803214347.html
I don't know this for sure but my understanding is that this way a Git checkout on a non-z/OS host doesn't run into issues when it is trying to convert your files into an EBCDIC code page. If you are sure that your project won't be checked out on a non-z/OS system you could also use working-tree-encoding
.
A sample .gitattributes file for your case would look like this:
*.cob zos-working-tree-encoding=ibm-1047
The .gitattributes file must be in UTF-8 (or ISO8859-1 but try to stick to UTF-8.)
Note: You might find some examples from IBM which also include the git-encoding parameter to specify how Git handles files internally. This should not be used anymore and defaults to UTF-8 (also on z/OS). It is described by Rocket here.
Note 2: Out of personal experience IBM-1047 is often times not enough as it doesn't include the € sign which is why we tend to use the national code page like ibm-1141 (over here in Germany). For the rest of the world this is likely not interesting.