Code Changes - raisercostin/software-wiki GitHub Wiki

Is best a commit to contain only a type of the following code changes. In this way someone can skip directly unintersting ones

Code transformations are:

  • simple
    • format/Reformat - changes only the white space: spaces, end of line, tabs, separators.
    • cleanup - changes documentation/comments, removal of dead code
    • reorderings - changes on the order of imports, functions, class definitions
  • refactorings - no intention to change the execution behavior
    • Refactoring - Changes that preserve the behavior as checked usually by tests. Usually followed by a bugfix/feature.
  • complex - there is intention to change the execution behavior
    • bugfix - Changes on code/test that make some tests pass.
    • feature - Changed on code/tests made through adding new code: see Open Closed Principle
    • restructure - any code change.
  • to classify
    • merge
    • rebases

Comments

Clean Code tip: Write clean commit messages

It’s the best tool to document the reason for change in your code.

Here are 5 tips on how I write commits in my team:

  1. Explain the WHY

❌ Add endpoint βœ… Add endpoint to enable users to download purchase history

  1. Summarize WHAT the commit does, not HOW it does it:

❌ Changed the button color by updating CSS file βœ… Update primary button color for better contrast

  1. Use present tense with imperative mood

❌ I have removed βœ… Remove ...

  1. Add link reference to the actual work item

❌ Fix login bug when user is inactive βœ… d342da: Fix login bug when user is inactive

  1. Don’t include file names - they are in the Git details ❌ Update dependencies in package.json βœ… Update dependencies to address security vulnerabilities

Clean commit messages are part of internal software quality.

From https://craftbettersoftware.com/p/write-clean-commit-messages

Se also