Good Practices to Follow Before Checking in Source Code
Here are a few nuggets of wisdom to consider before you check in source code to your version control system. Like any other software development system/rule-set/paradigm, this is merely advice. If you want to do everything on this list, great. If you want to use part of it, feel free. If you think it's lame and don't want to follow any of the advice on this list, that's fine also.
- Always Get latest - You should never try to check in code that is written on an old codebase. Get latest for your whole project and build it before you try checking anything in.
- Look at the diffs of the files you are about to check in - Did you miss something? Are all of the files there? Do you remove all of your debug code?
- Do not check in commented out code - if you need that code later, you can look at the revision history of that file and get it back. There is no need to have commented out code in your production system anymore.
- Run unit tests - If you have unit tests, you should run them at least every time you are ready to check in your files. Some developers might argue that you should run them more often, I would argue that this is a minimum.
- Write check-in comments - Always add relevant comments to your check-ins. What did this new code accomplish? Did you fix something or add a new feature?
Did I miss something? Let me know and I'll add it to the list.