Created
June 2, 2015 10:17
-
-
Save tmr111116/e8f7aa3e512d8e5d1d1d to your computer and use it in GitHub Desktop.
pull したタイミングで .DS_Store だけが含まれるフォルダを削除する git hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# pull したタイミングで .DS_Store を消して、 .DS_Store だけが含まれるフォルダを削除する。 | |
# | |
# まず .DS_Store を削除してから、 .DS_Store が入っていたディレクトリを rmdir する。 | |
# rmdir は空の場合しか削除しないので、中身が入っている場合はそのまま。 grep で不要なエラーメッセージを無視。 | |
find . -name .DS_Store -exec rm {} \; -exec sh -c 'rmdir `dirname {}` 2>&1 | grep -E -v "rmdir:.+: Directory not empty"' \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment