Exit Full View

Git Diff before Commit

Get into the habit of doing a git diff or git difftool before you commit changes.

I often catch these mistakes :

  • When I replace code, I sometimes leave the old code behind (commented out). Delete it!
  • Stray prinln statements. I tend to use println statements instead of an interactive debugger. Never leave them in committed code!
  • New methods without documentation.
  • My IDE making a real hash of refactoring code.

In particular, it sometimes adds fully-qualified class names when I move classes to another package.