DEV Community

loading...

A better way to Git Commit

muhammadhari profile image Muhammad Hari ・2 min read

What's Git?

As described on the official website, Git is a free and open-source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. git-scm.com

Git Commit

The "commit" is a command in git, it's used to save your changes to the local repository and captures a snapshot of the project's current stages changes. Committed snapshots can be thought of as "safe" version of a project, Git will never change them unless you explicitly ask it to.

The commit message should be structured as follows:

<type>(<scope>): <subject>

<body>

<footer>
Enter fullscreen mode Exit fullscreen mode
message <subject>:

First-line cannot be longer than 70 characters, the second line is always blank and other lines should be wrapped at 80 characters.

message <body>:
  • uses the imperative, present tense: change not changed nor changes.
  • includes motivation for the change and contrasts with previous behavior.
message <footer>:

Closed issues should be listed on a separate line in the footer prefixed with "Closes" keyword like this:

Closes #101
Enter fullscreen mode Exit fullscreen mode

or in case of multiple issues:

Closes #101, #102, #103
Enter fullscreen mode Exit fullscreen mode
<type> values:
  • feat (new feature).
  • fix (bug fix).
  • docs (changes to documentation).
  • style (formatting, missing semicolons, etc; no code change).
  • refactor (refactoring production code).
  • test (adding missing tests, refactoring tests; no production code change).
  • chore (updating grunt tasks etc; no production code change).
<scope> values:
  • init
  • runner
  • watcher
  • config
  • web-server
  • proxy
  • etc

The <scope> can be empty (eg. if the change is a global or difficult to assign to a single component), in which case the parentheses are omitted.

Breaking changes

All breaking changes have to be mentioned in footer with the description of the change, justification and migration notes.

BREAKING CHANGE:
`port-runner` command line option has changed to `runner-port`, so that it is
consistent with the configuration file syntax.

To migrate your project, change all the commands, where you use `--port-runner`
to `--runner-port`.
Enter fullscreen mode Exit fullscreen mode

Source from:
Karma

Discussion (0)

pic
Editor guide