Skip to content
  • Torsten Bögershausen's avatar
    add: introduce "--renormalize" · 9472935d
    Torsten Bögershausen authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    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: default avatarJunio C Hamano <gitster@pobox.com>
    Signed-off-by: default avatarTorsten Bögershausen <tboegi@web.de>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    9472935d