Atomic commit: Difference between revisions

Content deleted Content added
Atomic commit convention: Removing {{Merge to}} — no consensus in associated discussion
Rescuing 1 sources and tagging 0 as dead.) #IABot (v2.0.9.5
 
Line 44:
When using a revision control systems a common convention is to use small commits. These are sometimes referred to as atomic commits as they (ideally) only affect a single aspect of the system. These atomic commits allow for greater understandability, less effort to roll back changes, easier bug identification.<ref>{{cite web |publisher=Apache |title=Subversion Best Practices |url=http://svn.apache.org/repos/asf/subversion/trunk/doc/user/svn-best-practices.html}}</ref>
 
The greater understandability comes from the small size and focused nature of the commit. It is much easier to understand what is changed and reasoning behind the changes if one is only looking for one kind of change. This becomes especially important when making format changes to the source code. If format and functional changes are combined it becomes very difficult to identify useful changes. Imagine if the spacing in a file is changed from using tabs to three spaces every tab in the file will show as having been changed. This becomes critical if some functional changes are also made as a reviewer may simply not see the functional changes.<ref>{{cite book |first=Boisvert |last=Barney |title=Atomic Commits to Version Control |url=http://www.barneyb.com/barneyblog/2006/01/27/atomic-commits-to-version-control/}}</ref><ref>{{cite web |publisher=Conifer Systems |title=The Benefits of Small Commits |url=http://www.conifersystems.com/2008/11/05/the-benefits-of-small-commits/ |access-date=2010-07-28 |archive-date=2011-10-05 |archive-url=https://web.archive.org/web/20111005024703/http://www.conifersystems.com/2008/11/05/the-benefits-of-small-commits/ |url-status=dead }}</ref>
 
If only atomic commits are made then commits that introduce errors become much simpler to identify. One need not look through every commit to see if it was the cause of the error, only the commits dealing with that functionality need to be examined. If the error is to be rolled back, atomic commits again make the job much simpler. Instead of having to [[Reversion (software development)|revert]] to the offending revision and remove the changes manually before integrating any later changes; the developer can simply revert any changes in the identified commit. This also reduces the risk of a developer accidentally removing unrelated changes that happened to be in the same commit.