Last active
February 22, 2023 14:51
Revisions
-
Ilya Katz revised this gist
Jan 25, 2013 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,6 +11,7 @@ then exit 1 fi .git/hooks/pre-commit-debugger .git/hooks/pre-commit-trailing-spaces .git/hooks/pre-commit-images .git/hooks/pre-commit-pair -
Ilya Katz revised this gist
Jan 25, 2013 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,17 @@ #!/bin/sh # http://mark-story.com/posts/view/using-git-commit-hooks-to-prevent-stupid-mistakes if git-rev-parse --verify HEAD >/dev/null 2>&1; then against=HEAD else against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi for FILE in `git diff-index --check --name-status $against -- | cut -c3-` ; do # Check if the file contains 'debugger' if [ "grep 'debugger' $FILE" ] then echo $FILE ' contains debugger!' exit 1 fi done -
Ilya Katz revised this gist
Jan 25, 2013 . 5 changed files with 12 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,16 @@ #!/bin/bash -l # A git hook script to find and fix trailing whitespace # in your commits. Bypass it with the --no-verify option # to git-commit # .git/hooks/pre-commit-master-no-no if [[ $? == 1 ]] then exit 1 fi .git/hooks/pre-commit-trailing-spaces .git/hooks/pre-commit-images .git/hooks/pre-commit-pair 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,5 @@ #!/bin/bash -l echo "Optimizing images" # Find image files and optimize them 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ #!/bin/bash #Hook to verify that comments are not done to the master branch accidentally #Need to check the status and exit the hook if this script exits with a non-zero code 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ #!/bin/bash echo `git about |grep "git user"` 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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ #!/bin/bash echo "Remove trailing spaces" if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then -
Ilya Katz revised this gist
Jan 24, 2013 . 1 changed file with 0 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,5 @@ #!/bin/bash -l .git/hooks/pre-commit-master-no-no if [[ $? == 1 ]] then -
Ilya Katz revised this gist
Jan 24, 2013 . 1 changed file with 0 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,5 @@ #!/bin/bash -l # A git hook script to find and fix trailing whitespace # in your commits. Bypass it with the --no-verify option # to git-commit -
Ilya Katz revised this gist
Jan 24, 2013 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -11,4 +11,7 @@ source ./.rvmrc if [[ $? == 1 ]] then exit 1 fi .git/hooks/pre-commit-trailing-spaces .git/hooks/pre-commit-images -
Ilya Katz revised this gist
Jan 24, 2013 . 2 changed files with 30 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ #!/bin/bash -l source ./.rvmrc echo "Optimizing images" # Find image files and optimize them for FILE in `exec git diff --cached --name-status | grep ".png$" | awk '$1 != "R" { print $2 }'`; do echo "Optimizing $FILE" bundle exec smusher $FILE git add "$FILE" done 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ #!/bin/bash -l echo "Remove trailing spaces" if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then against=HEAD else # Initial commit: diff against an empty tree object against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi echo $against # Find files with trailing whitespace for FILE in `exec git diff-index --check $against -- | sed '/^[+-]/d' | (sed -r 's/:[0-9]+:.*//' > /dev/null 2>&1 || sed -E 's/:[0-9]+:.*//') | uniq` ; do # Fix them! echo $FILE (sed -i 's/[[:space:]]*$//' "$FILE" > /dev/null 2>&1 || sed -i '' -E 's/[[:space:]]*$//' "$FILE") git add "$FILE" done -
Ilya Katz revised this gist
Jan 24, 2013 . 1 changed file with 25 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ #!/bin/bash -l #Hook to verify that comments are not done to the master branch accidentally #Need to check the status and exit the hook if this script exits with a non-zero code #.git/hooks/pre-commit-master-no-no #if [[ $? == 1 ]] #then # exit 1 #fi if [[ `git symbolic-ref HEAD` == "refs/heads/master" ]] then if [[ ! -f /tmp/master_commit ]] then echo "*************************" echo "CANNOT COMMIT TO MASTER!" echo "To override this behavior" echo "touch /tmp/master_commit" echo "*************************" exit 1 else echo "Removing /tmp/master_commit" rm /tmp/master_commit fi fi -
Ilya Katz created this gist
Jan 24, 2013 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ #!/bin/bash -l source ./.rvmrc # A git hook script to find and fix trailing whitespace # in your commits. Bypass it with the --no-verify option # to git-commit # .git/hooks/pre-commit-master-no-no if [[ $? == 1 ]] then exit 1 fi