Skip to content

Commit 16d7c72

Browse files
authored
.gitattributes: specify eol as LF (#9892)
1 parent 34e2338 commit 16d7c72

File tree

2 files changed

+2
-34
lines changed

2 files changed

+2
-34
lines changed

.gitattributes

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
# This ensures that the line endings in any files added or modified are
2-
# normalized before being committed. On Windows they will automatically
3-
# be checked-out as CRLF, and re-converted to LF before check-in.
4-
# See https://git-scm.com/docs/gitattributes for more information.
5-
* text=auto
1+
# https://github.com/tldr-pages/tldr/issues/7097
2+
* text=auto eol=lf
63

74
# GitHub linguist ignores markdown files by default, but tldr-pages
85
# is mostly markdown, so we explicitly make the pages detectable

contributing-guides/git-terminal.md

-29
Original file line numberDiff line numberDiff line change
@@ -90,32 +90,3 @@ git push --force-with-lease
9090
```
9191

9292
[![asciicast](https://asciinema.org/a/fFMZzQOgJyfUf8HTnXyRj0v02.svg)](https://asciinema.org/a/fFMZzQOgJyfUf8HTnXyRj0v02)
93-
94-
# Editorconfig and Windows
95-
96-
There is an issue that could arise when you clone the repository under Windows and use an editor which honors the settings in the `.editorconfig` file. With the default configuration, when you initially clone the repository, Git checks out files converting line endings to `CRLF`. Later, when you edit some file, or just save it without any modifications, your editor converts line endings to `LF` as per configuration in the `.editorconfig`. This causes the confusion, making Git mark the files as modified whereas they are not and issue the following warnings on `git diff` and `git add`:
97-
98-
```
99-
warning: LF will be replaced by CRLF in...
100-
```
101-
102-
To handle this problem, you need to clone the repository using the command:
103-
104-
```sh
105-
git clone --config core.eol=lf {{remote_repository_location}}
106-
```
107-
108-
If you've already cloned the repository, and don't want to repeat the whole process (if, for example, you've already made some modifications), you can fix the issue using the following commands. Be careful as these commands are potentially dangerous and you can lose your unfinished work in the current repository!
109-
110-
```sh
111-
# set line feed (LF) as end of line
112-
git config --local core.eol lf
113-
# stash any local changes (if the working tree is clean, skip this step and the last one)
114-
git stash push
115-
# remove all the files under version control from index
116-
git rm -rfq --cached .
117-
# update all the files in index and working tree without converting LF to CRLF, as per new option value
118-
git reset --hard HEAD
119-
# restore the previous state from stash
120-
git stash pop --index
121-
```

0 commit comments

Comments
 (0)