Skip to content

Instantly share code, notes, and snippets.

@kbaribeau
Forked from anonymous/gist:4287263
Created December 14, 2012 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbaribeau/4287266 to your computer and use it in GitHub Desktop.
Save kbaribeau/4287266 to your computer and use it in GitHub Desktop.
function fix-file-endings () {
for f in `git ls-files`
do
newline='
'
lastline=$(tail -n 1 $f; echo x); lastline=${lastline%x}
[ "${lastline#"${lastline%?}"}" != "$newline" ] && echo >> $f
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment