DEV Community

Discussion on: Keep your Git history clean - 101

Collapse
 
simbo1905 profile image
Simon Massey • Edited

GitHub has a feature squash-and-merge that works very well with team development. Devs create a feature branch for an issue and make as many commits as they want without any tidying. When the issue is finished you squash-and-merge it and it lands back onto the main integration branch as a single commit. The full history can still be seen on the feature branch. On the main integration branch the history shows when feature landed as an atomic commit which is always far more helpful than seeing the work in progress commits of the feature branch. Using this technique the history of a large project can be kept extremely clean with zero effort.

Collapse
 
chriskarpyszyn profile image
Chris Karpyszyn

Not always useful as a feature branch may contain multiple units of work that could benefit from seperate commits. Really just depends on the scope of project and workflow.

Collapse
 
simbo1905 profile image
Simon Massey

sure. we prefer to break down work into small units that can be continuous integrated if we can. sometimes something large cannot. shipping something bigger in chunks hidden by a feature flag can reduce the integration risks. many teams work in sprints and try hard to make atomic tasks that can land as single commit where possible.