Adds a gitattributes file, this might be slightly controversial so read on and let's see if everyone thinks this is sensible.
I defined two rules in the file:
* text=auto - for automatic line ending normalization for all files
*.cs filter=tabspace - for automatic indentation normalization for all files with the .cs extension
tabspace is a filter and you need to define it locally in your environment.
We could store a filter definition in the repo itself but that might not work for everyone, depending on your set ups
On Linux and Windows, if you're using Git for Windows which comes with GNU CoreUtils
git config filter.tabspace.clean 'expand --tabs=4 --initial'git config filter.tabspace.smudge 'unexpand --tabs=4 --first-only'
The clean command is ran to normalize files when changes are added to index.
The smudge command is used to change them to your preferred format on checkout.
If you prefer to work with spaces for indentation, you could instead use
git config filter.tabspace.smudge 'cat'
The reason behind normalization to spaces is that when viewing the code in the browser, the default tab width is 8 spaces, which just explodes the code unreasonably when viewing it on eg. Github.
If you started checking in stuff on your branches before the addition of these files, we might want to do some cleanup afterwards, not a big deal.
Adds a standard Visual Studio .gitignore from https://www.gitignore.io/
Adds a gitattributes file, this might be slightly controversial so read on and let's see if everyone thinks this is sensible.
I defined two rules in the file:
* text=auto
- for automatic line ending normalization for all files*.cs filter=tabspace
- for automatic indentation normalization for all files with the .cs extensiontabspace is a filter and you need to define it locally in your environment. We could store a filter definition in the repo itself but that might not work for everyone, depending on your set ups
On Linux and Windows, if you're using Git for Windows which comes with GNU CoreUtils
git config filter.tabspace.clean 'expand --tabs=4 --initial'
git config filter.tabspace.smudge 'unexpand --tabs=4 --first-only'
The clean command is ran to normalize files when changes are added to index. The smudge command is used to change them to your preferred format on checkout.
If you prefer to work with spaces for indentation, you could instead use
git config filter.tabspace.smudge 'cat'
The reason behind normalization to spaces is that when viewing the code in the browser, the default tab width is 8 spaces, which just explodes the code unreasonably when viewing it on eg. Github.
If you started checking in stuff on your branches before the addition of these files, we might want to do some cleanup afterwards, not a big deal.