Read more on Stackoverflow: Why should I use core.autocrlf=true in Git? (external link)
git config core.autocrlf true |
You can make sure you follow this rule easily:
eol
setting.TM_STRIP_WHITESPACE_ON_SAVE = true
to your .tm_properties
file.ensure_newline_at_eof_on_save
option to true
.For visual studio, you can download this VS Settings file which will configure your environment properly.
Fixes "No newline at end of file" for all *.cs files (Requires Bash 4.0, based on this post http://stackoverflow.com/questions/3261925/how-to-fix-no-newline-at-end-of-file-compiler-warning-for-lots-of-files)
#!/bin/bash shopt -s globstar for i in **/*.cs ; do echo $i; \ if diff /dev/null "$i" | tail -1 | \ grep '^\\ No newline' > /dev/null; then echo >> "$i"; \ fi; done |
Ensure newlines are \n (example is for *.aspx files)
#!/bin/bash expand_func () { dos2unix -m -n "$1" "$1.tmp" mv "$1.tmp" "$1" } export -f expand_func find . -name \*.aspx -exec bash -c 'expand_func {}' \; |
Convert files indented with 4 spaces, to tabs
#!/bin/bash expand_func () { expand -t 4 "$1" > "$1.tmp" mv "$1.tmp" "$1" } export -f expand_func find . -name \*.aspx -exec bash -c 'expand_func {}' \; |