Created
May 6, 2011 09:33
-
-
Save yeban/958687 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*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 |
Can't imagine anyone else needing this script, Sid :-|.
There's atleast one other gist that attempts to do this same thing (except
not as elegantly)
…On Fri, Feb 3, 2012 at 2:33 AM, Anurag Priyam < ***@***.*** > wrote:
Can't imagine anyone else needing this script, Sid :-|.
---
Reply to this email directly or view it on GitHub:
https://gist.github.com/958687
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
useful!