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.

2 thoughts on “Setting your GitHub repository to recognize file languages

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s