Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
barcelona-group-assignment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Academany
Fab Academy
2022
Fab Academy 2022 Labs
Barcelona
Barcelona students
barcelona-group-assignment
Commits
245d4817
Commit
245d4817
authored
3 years ago
by
Edu Almas
Browse files
Options
Downloads
Patches
Plain Diff
Added "git tips" page to avoid problems when collaborating in groups with different OSes.
parent
982fa7db
No related branches found
No related tags found
No related merge requests found
Pipeline
#278440
passed with warnings
3 years ago
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/assignments/tips/git-settings.md
+62
-0
62 additions, 0 deletions
docs/assignments/tips/git-settings.md
with
62 additions
and
0 deletions
docs/assignments/tips/git-settings.md
0 → 100644
+
62
−
0
View file @
245d4817
# 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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment