-
-
Save jay3126/1723323 to your computer and use it in GitHub Desktop.
Git pre-commit hook to remove stray debugger statements from your merb project.
This file contains 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 | |
# Remove stray debugger statements from the modified files before committing | |
# get a list of added, modified, copied files | |
files=`git diff --cached --name-only --diff-filter=ACM` | |
# remove debugger lines | |
# | |
# 1. remove any line containing a debugger | |
# sed -i "/debugger/d" $files | |
# | |
# 2. remove lines that contains only a debugger | |
sed -i "/^\s*-*\s*debugger\s*$/d" $files | |
# | |
# 3. remove commented/un-commented lines that contain only a debugger | |
# sed -i "/^\s*#*\s*debugger\s*$/d" $files | |
# re-stage the modified files | |
git add $files |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment