summaryrefslogtreecommitdiffstats
path: root/.gitattributes
diff options
context:
space:
mode:
authorBrian Fitzgerald <neurocline@gmail.com>2018-04-04 16:46:05 -0700
committerAnthony Fok <foka@debian.org>2018-06-14 16:08:34 -0600
commit6a2968fd5c0116d93de0f379ac615e9076821899 (patch)
treece3317d6267ddd40b2c77abb70f4d223dc06806b /.gitattributes
parent23d5fc82ee01d56440d0991c899acd31e9b63e27 (diff)
Adds .gitattributes to force Go files to LF
Even on Windows machines, we want *.go files to have LF line endings (go fmt insists). This leaves other files as auto, but makes *.go files always be LF on Windows machines. With this change, running go fmt will be a pleasant operation, not a painful one. Note that changing .gitattributes only affects files at initial checkout. To update an entire working directory after making a change like this, do this (but only after committing all work in progress, this will destroy uncommitted changes): $ git rm --cached -r . $ git reset --hard Again - do not do this to a working directory with uncommitted work in it.
Diffstat (limited to '.gitattributes')
-rw-r--r--.gitattributes5
1 files changed, 5 insertions, 0 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000..1a5b760ec
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,5 @@
+# Text files have auto line endings
+* text=auto
+
+# Go source files always have LF line endings
+*.go text eol=lf