Git – checking JavaScript files for debugger statements

We developers, when working on a common codebase, often step on each other’s toes. Recently, while debugging code of a complex application server I have been hit with JavaScript debugger statements placed by another developer all around, that should not get to the common branch. So what is better than complaining to your colleagues to be more careful every time they commit code? Present them with a Git hook that does the checking for them and solves the problem once and for all 🙂 This hook is an expansion of the previous one.
Continue reading “Git – checking JavaScript files for debugger statements”

Git – confirmation before commit

I use Git for version control of all my projects. Every repository of course has many branches that I try to systematize like: stable, devel, experimental, per-feature etc. Many times I have run into the problem of committing my changes to the branch I did not intended to. Git shows you the branch and changed files when entering the commit message, but when you do that 50 times a day you are doomed to loose focus (and commit your experimental stuff into a stable branch 🙂 ).

My solution to this problem is a simple pre-commit hook that reads the name of the branch and prompts for confirmation, if the name of the branch is on a watchlist.
Continue reading “Git – confirmation before commit”