Skip to content

Commit 167580a

Browse files
author
Ray Schamp
committed
Exclude node_modules
Also break up find command into multiple lines
1 parent a29261d commit 167580a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

prune-gh-pages.sh

+10-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,16 @@ done
4343
branches=$(echo "${branches[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')
4444

4545
# Remove all directories that don't have corresponding branches
46-
find . -type d \( -path ./.git $(printf " -o -path ./%s" $branches) \) -prune -o -type d -mindepth 1 -exec rm -rfv {} \;
46+
# It would be nice if we could exclude everything in .gitignore, but we're
47+
# not on the branch with the .gitignore anymore... so we can't.
48+
find . -type d \
49+
\( \
50+
-path ./.git -o \
51+
-path ./node_modules \
52+
$(printf " -o -path ./%s" $branches) \
53+
\) -prune \
54+
-o -mindepth 1 -type d \
55+
-exec rm -rfv {} \;
4756

4857
# Push
4958
git add -u

0 commit comments

Comments
 (0)