# Git Config

# Docs
before proceeding, read these thoroughly:
- [Stack Overflow: Git replacing LF with CRLF](https://stackoverflow.com/questions/1967370/git-replacing-lf-with-crlf)
- [Stack Overflow: LF will be replaced by CRLF in git - What is that and is it important?](https://stackoverflow.com/questions/5834014/lf-will-be-replaced-by-crlf-in-git-what-is-that-and-is-it-important)
- [GitHub Docs: Configuring Git to handle line endings](https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings)
- [The reference from Git itself](https://git-scm.com/docs/git-config)

## Where is the global Git Config file?
- Windows : `C:/Users/<USER_NAME>/.gitconfig`
- Unix: `~/.gitconfig`

## Changing Configs
To list all configs:
```
git config --global --list
```

To unset a config:
```
git config --global --unset core.autocrlf
```
If there are multiple records with the same key,
```
git config --global --unset-all core.autocrlf
```

To replace values of the config:
```
git config --global --replace-all core.autocrlf "New Value"
```

To remove an entire section:
```
git config --global --remove-section core
```

Or to edit the config file manually:
```
git config --global --edit
```
[Source](https://stackoverflow.com/a/11868676)


## EOL in Git
There are 3 configs related to EOL:
- `core.eol`
- `core.autocrlf`
- `core.safecrlf`

If the EOLs at all messed up, you can also use:
```
git add --renormalize .
```
[Source](https://stackoverflow.com/questions/7156694)

Also after changing the configs, It's usually a good idea to discard unwanted changes:
```
git rm --cached -r .
git reset --hard
```
[Source](https://stackoverflow.com/a/29888735)

## What I Figured Out
At the end (until 2024/02/24), I figured, for me, it's best to:
- Remove `core.eol`
- Remove `core.safecrlf`
- Set `core.autocrlf` to `false`
