DEV Community

xensan_dev
xensan_dev

Posted on

A Quick Guide to Meaningful Commits!

What are commits?

A commit is a command from Git that allows a user to save snippets of code in the order they were added/changed. Think of commits as snapshots of your code in a timeline. Commits allow a user to be able to go back to each addition/change done to the local repository and control the version afterwards.

Why are commit messages important?

Commit messages are important because it lets the current coder know what was changed during that point in the timeline.

Be specific with your commits!

Commit messages should be specific! You should be able to describe what was added/changed in your commit.

Example of a bad commit:
git commit -m "pushing fixes"

  • Vague
  • Does not help the user or the team figure out what was fixed

Example of a good commit:
git commit -m "addition function was missing a variable"

  • More descriptive
  • Identified the error and describes where it was

You can be as descriptive as you want but make sure to keep your commits short. So long as you are able to summarize and understand what was changed or added.

If you got this far thank you!

Top comments (0)