Curious About Git Commit Types? Let’s Dive In!

Jaimin Prajapati
4 min readApr 27, 2024

--

Photo by Praveen Thirumurugan on Unsplash

Let’s face it — Git commit messages might not be the most glamorous part of software development, but they’re like the secret sauce that flavors your codebase. In this blog post, we’re going to take a trip to the magical world of Git commit types, where the right words can make your code sing, your team dance, and your development process sparkle.

The Enchanting World of Git Commit Types

Imagine Git commit types as your code’s emotions, each with its unique dance move on the version control stage. They’re the key to unlocking a treasure chest of benefits, including clarity, organization, and automated magic spells for your development workflow.

1. The Feat of Feats (feat)

Picture this commit type as the introduction of a thrilling new character in your code story. When you add a new feature, you’re inviting the star of the show to the stage. With ‘feat,’ you signal that something exciting is about to happen!

feat(profile): Add user profile picture upload

In this commit, with the scope "profile," we introduce the much-awaited
feature of allowing users to upload profile pictures. Now, our users can
personalize their profiles with their favorite images.

2. The Fixer-Upper (fix)

Meet your code’s superhero — the ‘fix’ commit type! It swoops in to rescue your code from bugs and glitches, making everything run smoothly again. When your code is in distress, ‘fix’ is there to save the day.

fix(login): Resolve login page redirection bug

With the scope "login," this commit fixes a pesky bug that was causing
users to be redirected to the wrong page after logging in. No more
getting lost in the labyrinth of our application!

3. The Refactor Wizard (refactor)

Sometimes, your code needs a makeover, and that’s where ‘refactor’ shines. It’s like giving your code a new outfit — same character, but a whole new look. ‘Refactor’ adds style, grace, and elegance to your codebase.

refactor(database): Simplify database connection code

Focusing on the "database" scope, this commit refactors the database
connection code to make it more streamlined and efficient. It's like
giving our codebase a mini makeover for improved performance.

4. The Choreographer (chore)

Every production needs behind-the-scenes work, and that’s where ‘chore’ commits come in. They handle the props, lighting, and other backstage tasks that keep the show running smoothly. ‘Chore’ commits ensure your code’s performance remains top-notch.

chore(dependencies): Update third-party libraries

Within the scope of "dependencies," this commit updates our third-party
libraries to their latest versions. It's routine maintenance to keep our
codebase up-to-date with the latest improvements and security patches.

5. The Scribe (docs)

Documentation is the storyteller of your code. ‘Docs’ commits are the chroniclers, capturing every detail, character, and plot twist. They ensure everyone knows the code’s backstory, creating a more cohesive narrative.

docs(api): Update API documentation for v2 endpoints

In the "api" scope, our API documentation just got a facelift. This commit
updates the documentation for our version 2 endpoints, making it easier for
developers to understand and use our APIs. It's like enhancing the script
of a play to make it even more engaging for the audience.

6. The Tester Extraordinaire (test)

‘Test’ commits are your code’s quality assurance experts. They ensure that your characters (code functions) always hit their marks, delivering a flawless performance. No bugs get past these vigilant guardians.

test(registration): Add unit tests for user registration

Focusing on "registration," this commit introduces new unit tests to
ensure our user registration process runs smoothly. Now, we can catch
any registration-related issues early in the development process, like
a dress rehearsal before the big show.

7. The Stylist (style)

Imagine ‘style’ commits as the makeup artists for your code. They focus on the aesthetics, making sure your code is well-groomed and adheres to the latest fashion trends (coding standards).

style(main.js): Fix indentation in main.js

In the context of the "main.js" file, this small but important change!
This commit corrects the indentation, making our code more readable
and in line with our coding standards. It's like tidying up the actors'
costumes to ensure they look their best on stage.

8. The Speedster (perf)

Sometimes, your code needs to hit the gym and shed a few milliseconds. ‘Perf’ commits are the personal trainers, ensuring your code’s performance is in tip-top shape.

perf(images): Optimize image loading for faster page rendering

Specifically within the "images" scope, users will notice a speed boost!
This commit optimizes image loading, resulting in faster page rendering
and a smoother user experience. It's like giving our code a burst of
energy for its performance.

9. The CI/CD Conductor (ci)

Your code deserves a grand entrance, and ‘ci’ commits are the maestros of continuous integration and deployment. They orchestrate the show, ensuring your code takes center stage with each update.

ci(pipeline): Update CI/CD pipeline for automatic deployments

In the "pipeline" scope, our CI/CD pipeline is now smarter than ever.
This commit updates it to automatically deploy new changes to production,
ensuring a seamless release process. It's like conducting a symphony,
ensuring all the instruments play in perfect harmony during a live
performance.

10. The Time Traveler (revert)

‘Revert’ commits are like the magical undo button. They can transport your code back in time, undoing previous changes and restoring order to the code kingdom.

revert(profile): Revert "feat(profile): Add user profile picture upload"

Oops! We found a critical issue with the profile picture upload feature
within the "profile" scope, so this commit reverts the previous commit
that introduced it. We'll fix the issue and try again. It's like rewinding
a scene in a play to get it just right before the curtain rises.

--

--

Jaimin Prajapati

👋 Full-stack developer turning ideas into digital magic with code. 🚀 Passionate about crafting elegant solutions. Let's connect!