Skip to content

Instantly share code, notes, and snippets.

@tai2
Created October 28, 2013 15:23
Show Gist options
  • Select an option

  • Save tai2/7198772 to your computer and use it in GitHub Desktop.

Select an option

Save tai2/7198772 to your computer and use it in GitHub Desktop.
replace CR -> LF in files to be commited
#!/bin/sh
# Redirect output to stderr.
exec 1>&2
for file in `git status --porcelain | grep '^[AM] ' | sed 's/^...//'`
do
ext=${file##*.}
if [ $ext = "as" ]; then
cat $file | tr '\r' '\n' > $file".tmp"
mv $file".tmp" $file
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment