From 245d48170507d6fd4e104f5dc737b311d5bbd882 Mon Sep 17 00:00:00 2001
From: Edu Almas <edu.fablabbcn.2022@gmail.com>
Date: Mon, 14 Feb 2022 23:26:06 +0100
Subject: [PATCH] Added "git tips" page to avoid problems when collaborating in
 groups with different OSes.

---
 docs/assignments/tips/git-settings.md | 62 +++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)
 create mode 100644 docs/assignments/tips/git-settings.md

diff --git a/docs/assignments/tips/git-settings.md b/docs/assignments/tips/git-settings.md
new file mode 100644
index 0000000..c3479ac
--- /dev/null
+++ b/docs/assignments/tips/git-settings.md
@@ -0,0 +1,62 @@
+# Tips when collaborating with git across different operating systems
+
+!!! warning "Important"
+    configuring this before we start contributing to this repo will save us lots of headaches down the road
+
+!!! info "tl;dr"
+    Different operating systems encode the "end of a line" in text files in different ways.
+
+    git supports them all, but we must configure each of our computers correctly, to avoid messing things up for other people in our team.
+
+Checkout that you configured
+your [git settings according to this guide](https://stackoverflow.com/questions/10418975/how-to-change-line-ending-settings)
+before committing files in this repo.
+
+## How to fix it
+
+### Windows users
+
+the git setting called 'core.autocrlf' should be set to 'true'
+
+```bash
+git config --global core.autocrlf true
+```
+
+### Linux/Mac/Unix users
+
+the git setting called 'core.autocrlf' should be set to 'input'
+
+```bash
+git config --global core.autocrlf input
+```
+
+## So... What happens if I don't configure it correctly?
+
+you will likely notice that LOTS of files appear to be modified, but when you go check out the differences, nothing
+seems to be changed.
+
+You will also notice it, if you see this output when you run `git diff`
+
+```
+$ git diff
+warning: LF will be replaced by CRLF in README.md.
+The file will have its original line endings in your working directory
+warning: LF will be replaced by CRLF in cinder-superhero/404.html.
+The file will have its original line endings in your working directory
+warning: LF will be replaced by CRLF in cinder-superhero/base.html.
+The file will have its original line endings in your working directory
+warning: LF will be replaced by CRLF in cinder-superhero/content.html.
+The file will have its original line endings in your working directory
+warning: LF will be replaced by CRLF in cinder-superhero/css/base.css.
+[...]
+```
+
+This isn't too bad until you consider the consequences: Since you are effectively changing each of the lines (the last
+character of the line is the line ending), git will treat that line as "modified by you", if anyone else makes any
+change, git will consider that "two people changed the same line" => bring up the "Merge conflict error".
+
+The ultimate consequence of this is that the rest of the team will be carrying the burden of your misconfiguration.
+
+!!! warning "This will result in lots more _merge conflicts_ than normal."
+
+For more info, check out [the official doc](https://www.git-scm.com/book/en/v2/Customizing-Git-Git-Configuration)
\ No newline at end of file
-- 
GitLab