]> git.ipfire.org Git - thirdparty/git.git/commit - cache.h
add: introduce "--renormalize"
authorTorsten Bögershausen <tboegi@web.de>
Thu, 16 Nov 2017 16:38:28 +0000 (17:38 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 17 Nov 2017 01:31:05 +0000 (10:31 +0900)
commit9472935d81eaf9faed771878c9df0216ae0d9045
tree9e8ed5c59d04b47defd123a1110fde0c38305328
parentcb5918aa0d50f50e83787f65c2ddc3dcb10159fe
add: introduce "--renormalize"

Make it safer to normalize the line endings in a repository.
Files that had been commited with CRLF will be commited with LF.

The old way to normalize a repo was like this:

 # Make sure that there are not untracked files
 $ echo "* text=auto" >.gitattributes
 $ git read-tree --empty
 $ git add .
 $ git commit -m "Introduce end-of-line normalization"

The user must make sure that there are no untracked files,
otherwise they would have been added and tracked from now on.

The new "add --renormalize" does not add untracked files:

 $ echo "* text=auto" >.gitattributes
 $ git add --renormalize .
 $ git commit -m "Introduce end-of-line normalization"

Note that "git add --renormalize <pathspec>" is the short form for
"git add -u --renormalize <pathspec>".

While at it, document that the same renormalization may be needed,
whenever a clean filter is added or changed.

Helped-By: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-add.txt
Documentation/gitattributes.txt
builtin/add.c
cache.h
read-cache.c
sha1_file.c
t/t0025-crlf-renormalize.sh [new file with mode: 0755]