DEV Community

Discussion on: The Case Against Print Statements in your Main Branch

Collapse
 
leob profile image
leob

Agree 100%, print/console.log is only a temp debug tool and does not belong in your Git repo. Always review your changes before you commit, and take the print statements out.

Collapse
 
moopet profile image
Ben Sinclair

I don't think there's anything wrong with having debugging statements in your repo, as long as they're in a feature branch, but you should clear them out before merging back to the main branch (usually develop).

There shouldn't be a fear of committing anything, because committing isn't just about sharing your work with the project, it's also for you as an individual. If you go home and work from a different computer, you're going to want the changes you made earlier in the day.

You can squash your commits if you don't want any record of your work-in-progress or debugging attempts to appear in the VCS history.

Collapse
 
aryanjnyc profile image
Aryan J

Agreed!