Search code examples
gitline-endingscore.autocrlf

How can I re-normalize my git repo


I have updated core.autocrlf option to be true (under Windows); now I want to re-normalize my git repository. How can I do that?


Solution

  • git rm --cached -r .
    # Remove everything from the index.
    
    git reset --hard
    # Write both the index and working directory from git's database.
    
    git add .
    # Prepare to make a commit by staging all the files that will get normalized.
    # This is your chance to inspect which files were never normalized. You should
    # get lots of messages like: "warning: CRLF will be replaced by LF in file."
    
    git commit -m "Normalize line endings"
    # Commit
    

    Reference: https://help.github.com/articles/dealing-with-line-endings