Setting your GitHub repository to recognize file languages

If your writing code in languages that are based on a common language but their files names have an uncommon extension, for example, the 3D shading languages OSL, and HLSL, which are written in C syntax but have .osl and .hlsl, or .fx as file name extensions,
GitHub wont automatically recognize that the code in these files is actually C language and present their syntax properly.

It’s very easy to fix this by adding a simple setting to your .gitattributes file, that tells GitHub’s linguist system to associate a specific file extension with the wanted language like this example:

# consider OSL as C language
* .osl linguist-language=C

 

Related:
Associate file type with languages in Notepad++
UE4 GitHub first steps.