Git on Windows and file attributes
No. Git doesn't track full UNIX permissions either, it just remembers the executable bit for convenience. As to why — it's a version control system, designed to track primarily source code. Which makes that feature downright useless (not to mention 'hidden' attribute is quite useless on its own, too).
You can use the post-checkout client-side hook to make any changes you need to make. In your case, you'd use it to run a script which sets the Windows file attributes you want.
ProGit describes this in general terms in the "Other Client Hooks" paragraph:
Customizing Git Hooks
Also, see githooks man page.
I tried @wadesworld suggestion and came up with this, Create the file \.git\hooks\post-checkout
with the content:
#!/usr/bin/env pwsh
param (
$PreviousHead,
$NewHead,
# Branch 1, File 0.
$BranchOrFile
)
$Name = '.HideMe'
if ((Test-Path $Name) -and !(Get-Item $Name -Force).Attributes.HasFlag([IO.FileAttributes]::Hidden)) {
(Get-Item $Name).Attributes += 'Hidden'
}
Change .HideMe
to the file/folder you want to hide, you can also use the 3 parameters if needed, like for example run only on branch checkout or file checkout. This needs PowerShell Core installed to work but could probably be implemented in cmd or Windows PowerShell as well.