While playing, hit "shift~" buttons.
Then type "g_godmode 1" and enter.
Type "shift~" and you are ready to play in god mode. For each level of the game or whenever you return to the game after quitting, you will need to reenter god mode. It does not save the cheat for you.
Also, for a list of codes type "help" after first typing "shift~". I have not found these to be so useful.