Skip to content

Instantly share code, notes, and snippets.

@shyazusa
Last active October 14, 2016 01:21
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 shyazusa/e61655fa7a97a1f97777e5b2fd0302fb to your computer and use it in GitHub Desktop.
Save shyazusa/e61655fa7a97a1f97777e5b2fd0302fb to your computer and use it in GitHub Desktop.
commitしたとき,.mdファイルの「、」を「,」に.「。」を「.」に置換する

Use pre-commit

$ cd "your project path"
$ cp pre-commit .git/hooks/
#!/bin/sh
if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
for FILE in `git diff-index --name-status $against -- | grep -E '^[AUM].*\.md$'| cut -c3-`; do
find $FILE | xargs sed -i "s/、/,/g"
find $FILE | xargs sed -i "s/。/./g"
git add $FILE
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment