Git status ignore line endings / identical files / windows & linux environment / dropbox / mled

后端 未结 6 1704
离开以前
离开以前 2020-12-02 07:42

How do I make

git status

ignore line ending differences?

Background info:

I use randomly Windows and Linux to w

6条回答
  •  有刺的猬
    2020-12-02 07:48

    I use both windows and linux, but the solution core.autocrlf true didn't help me. I even got nothing changed after git checkout .

    So I use workaround to substitute git status - gitstatus.sh

    #!/bin/bash
    
    git status | grep modified | cut -d' ' -f 4 | while read x; do
     x1="$(git show HEAD:$x | md5sum | cut -d' ' -f 1 )"
     x2="$(cat $x | md5sum | cut -d' ' -f 1 )"
    
     if [ "$x1" != "$x2" ]; then
        echo "$x NOT IDENTICAL"
     fi
    done
    

    I just compare md5sum of a file and its brother at repository.

    Example output:

    $ ./gitstatus.sh
    application/script.php NOT IDENTICAL
    application/storage/logs/laravel.log NOT IDENTICAL
    

提交回复
热议问题