Skip to content

Instantly share code, notes, and snippets.

@tmr111116
Created June 2, 2015 10:17
Show Gist options
  • Select an option

  • Save tmr111116/e8f7aa3e512d8e5d1d1d to your computer and use it in GitHub Desktop.

Select an option

Save tmr111116/e8f7aa3e512d8e5d1d1d to your computer and use it in GitHub Desktop.

Revisions

  1. tmr111116 created this gist Jun 2, 2015.
    7 changes: 7 additions & 0 deletions post-merge
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    #!/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"' \;