It is good to do often for the same reason that it is good to make frequent backups. Lock when you have code that you do not want to lose, say after a successful make check .
Unlike most centralized version control systems, such as Subversion or CVS, you can go back and polish the dirty history after your code is ready, but before you click or share it with the world, so git doesn't let you โdo it right the first time. "
source share