To add the latest changes of a source code in a project's repository
Wikipedia
What is, if any, the ideal size and content for a commit?
Save and commit every time a line is changed?
Do a single commit once the work is ready for QA?
Should be atomic, from the greek "atomos", "indivisible"
Just one criteria
In other words, should do one thing but well and fully without breaking the application
Issue with too small commits:
They put the state of the application in a broken state
Issue with too big commits:
They contain too much content and are hardly reviewable and debuggable
If the commit put the application in an unstable state, it might miss content.
If the commit message contains "and", it might be split into two commits.
The other way around is false though!
VCSs are used to:
But what if it can also be used to debug for example? Or to help doing code reviews?
Binary search
Checkout commits according to binary search and asks the developer to test on the chosen commit
Binary search
Binary search
Important to have commits which don't break the application
Binary search
Once the commit introducing the bug is found, the developer can then find the origin of the bug itself
Binary search
If a commit containing a bug is huge and multi-feature (not atomic), the developer is not helped in the debug
From one of my projects, where my commit history was not well done and I had to redo it slightly to find a bug
https://git-scm.com/docs/git-bisect
http://ghislain-rodrigues.fr/articles/git-add---interactive.html
http://seesparkbox.com/foundry/atomic_commits_with_git