Skip to content

Commit

Permalink
add post-checkout git-hook to delete .pyc files
Browse files Browse the repository at this point in the history
this is a common source of confusion when trying to reproduce
an error on another branch
  • Loading branch information
dannyroberts committed Feb 26, 2014
1 parent 005ccdb commit 96077e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 7 additions & 3 deletions git-hooks/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,12 @@ function git-submodule-list() {
git submodule | sed 's/^+/ /' | cut -f3 -d' '
}

cp git-hooks/pre-commit.sh .git/hooks/pre-commit
for submodule in $(git-submodule-list)
for hook in 'pre-commit' 'post-checkout'
do
cp $CP_OPT git-hooks/pre-commit.sh .git/modules/$submodule/hooks/pre-commit

cp git-hooks/$hook.sh .git/hooks/$hook
for submodule in $(git-submodule-list)
do
cp $CP_OPT git-hooks/$hook.sh .git/modules/$submodule/hooks/$hook
done
done
4 changes: 4 additions & 0 deletions git-hooks/post-checkout.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

# do this in the background so your prompt doesn't hang
find . -name '*.pyc' -delete &

0 comments on commit 96077e3

Please sign in to comment.