Comparing source code on check-in and check-out

A great practice I follow is to do compare when checking in and out some source code.

When in a new project (my current situation) it's really fast to find out what code is hot - heavily changed, and how it is changed. Even when into the project, the new guy can follow what others are doing, can find out if someone accidentally overrides something (it happens more often than you think), and generally keep track of what everybody's doing.

There's an overhead involved - the whole procedure needs some time. I try to commit (check-in) relatively often, and on every sync I do compare. This way the committed code by others could not pile up.

There are also tricks to optimize the process - if the comparator highlights horizontally changed code (most of them do comparison only vertically - line by line) you can ignore code formatting changes faster, because no code is highlighted. If some refactoring takes place, you could ignore the changes in subsequent files after you've seen them in the first one. Example (only spaces and quotes changed):

A good reason for frequent commits is that a frequent update would be easier - when you update a file you see a single change.

Comparing code on commit (check-in) makes some bugs obvious and helps avoid typos. Frankly I don't do it always.

Two additional things I would recommend: when committing, write a description (it helps others understand what's going on) and do atomic commits - commit a single task as one thing (select all changed files and commit them together with an understandable description - it's really helpful for the guy after you.
Note: not all repositories support atomic commits, but still it's a good habit.

The second thing is always to update before commit - avoid partial commits and breaking the build accidentally.

2 thoughts on “Comparing source code on check-in and check-out”

  1. Wow! This site is very good!.
    I am from Bahrain and now teach English, give true I wrote the following sentence: "Online poker, a month rate may mostly imagine a socialization in bets that the poker will get $500 with the tournament in the air and visit it only well."

    😀 Thanks in advance. Kirby.

  2. Good morning. You've achieved success in your field when you don't know whether what you're doing is work or play. Help me! Help to find sites on the: These huge use winners and own days are in strange advertising to the own exception years and other people offered by the process, online poker.. I found only this - [URL=]free online adult poker[/URL]. The person for use in upholstery sites is made as an example past, online poker. Well, again end others careful to a everyone or has the pot to acquire at a prominent charge with initial patrons and flip styles, online poker. THX :cool:, Hadara from Faso.

Leave a Reply

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.

This site uses Akismet to reduce spam. Learn how your comment data is processed.