Using same respository for two OS ~/bin/ scripts

I am managing several Macs and several Linux machines.
At present I am able to keep all of the machines in sync nicely with git/github.
However, there some ~/.bin scripts that I have which are machine specific. I know I can gitignore a certain bin/filename when it comes to push but that seems to just on or off.
I’m wondering if when I do a pull to update my machines, is there a way to check which machine is doing the pull and ignore some files that would originally be updated from the repository.
The final result would be that bin/filename would be in the repository and would only show up on the mac machines and not downloaded on the linux machines and vice versa.
Is this possible?