Skip to content

Instantly share code, notes, and snippets.

View yuxi-liu-wired's full-sized avatar

Yuxi Liu yuxi-liu-wired

View GitHub Profile
@yuxi-liu-wired
yuxi-liu-wired / crlf_to_lf.sh
Last active December 4, 2023 03:32
Run this in your local Git repo to convert it from CRLF to LF ending, and make sure it *stay so*.
#!/bin/bash
git config --global core.eol lf
git config --global core.autocrlf input
echo "* text=auto eol=lf" > .gitattributes
# Find files but exclude .git directory
find . -type f ! -path '*/.git/*' | while read -r file; do
# Check if the file is a text file
if file "$file" | grep -q text; then