One habit that I’ve gotten into that has saved me from looking like an idiot nearly as often is to always look at a diff before I commit. I don’t do this as much in Mercurial, but with SVN when you do automatic deployments to testing servers, a stray alert in your javascript or var_dump in your php can screw up other people’s work. I wrote a small bash script to make it easier for me to check my diffs. Feel free to make it your own. If you have any suggestions for improving it, I’m always looking for ways to improve my dev process. I call it difff for:
Differentiate
Improvements
From
F***ing
Failures
[bash]
difff() {
svn diff > ~/diff.diff
vim ~/diff.diff
}
[/bash]
EDIT: Make sure to check out the comments below to see Jon Cave’s take on this.