Update the single purpose on the git etiquette
This commit is contained in:
parent
39629cdf31
commit
a55d752c10
|
@ -38,6 +38,24 @@ Commits are the building blocks of version controlling via Git. It's obvious tha
|
|||
quality will result in improvement in the overall quality of the repository.
|
||||
|
||||
** Single purpose commits
|
||||
Oftentimes engineers working on something get sidetracked into doing too many things when working on
|
||||
one particular thing like when you are trying to fix one particular bug and you spot another one,
|
||||
and you can’t resist the urge to fix that as well. And another one. Soon, it snowballs and you end
|
||||
up with so many changes all going together in one commit.
|
||||
|
||||
This is problematic, and it is better to keep commits as small and focused as possible for many
|
||||
reasons, including:
|
||||
|
||||
- It makes it easier for other people in the team looking at your change, making code reviews
|
||||
more efficient.
|
||||
- If the commit has to be rolled back completely, it’s far easier to do so.
|
||||
- It's straightforward to track these changes with your ticketing system.
|
||||
- It helps you mentally parse changes you’ve made using git log.
|
||||
|
||||
A commit should be a wrapper for related changes. For example, fixing two different bugs should
|
||||
produce two separate commits. Small commits make it easier for other team members to understand
|
||||
the changes and roll them back if something went wrong. With tools like the staging area and the
|
||||
ability to stage only parts of a file, Git makes it easy to create very granular commits.
|
||||
|
||||
** Commit Messages
|
||||
On many occasions we need to inspect the *Git* history to find something. A commit, specific changes,
|
||||
|
|
Loading…
Reference in New Issue