Often commit messages are tied to one or another Jira ticket or such. For example "ZOO-123: Fix to RabbitMQ binder names." This ties that commit with Jira ticket ZOO-123 that either is about changes to RabbitMQ messaging or about fixing an issue with said messaging. Also, some companies use conventional commits. It is just a way of formatting your commit message so that automated tools can process commits in an easier way. Read about it from https://www.conventionalcommits.org/en/v1.0.0/ An example would be "fix(ZOO-123): Fix to RabbitMQ binder names." There the fix() keyword shows that the commit was for fixing something. A feat() keyword can be for adding a new feature or for working with some new functionality. For example "feat(SCHOOL-23): Add Japanese language." The commit message itself is often in imperative present tense. For example "Fix to" instead of "Fixed". The commit should give a summary of the change. What was done. Keep it concise and clear. Do not add a whole essay. But also do not just write "Added more changes." Which changes? Why? Read about it from https://blog.devgenius.io/make-a-meaningful-git-commit-message-with-semantic-commit-message-b39a79b13aa3 Avoid frustration and all kind of nonsense in the commits. Yes, when the stuff does not work and your earlier commit did not fix it then writing "Get working already!!!!!" or "wgo8g7tfwo82w37fdto238gd" is not a rational way how to deal with the issue. It is unprofessional. In the previous company I worked at, we had one guy who raged in his commit messages. Avoid adding too many details. Instead of writing "Fix to UserNotificationIntegrationTest, BillingIntegrationTest, BaseIntegrationTest, RabbitMQPublisherIntegrationTest" better pick "Fix to integration tests". Which tests, that can be seen from the git commit itself. Neither go with "Added an email support to UserNotificationService by introducing emailSender() method that uses angus-mail library" just write "Add support to send user notifications via email" Some good and bad examples are in https://chris.beams.io/git-commit Also, it does not really help when you finish your whole project and then add it via a single commit that has a commit message of "Initial commit". Answer from mandzeete on reddit.com
🌐
Conventional Commits
conventionalcommits.org › en › v1.0.0
Conventional Commits
Commits with BREAKING CHANGE in the commits, regardless of type, should be translated to MAJOR releases. We recommend using SemVer to release your own extensions to this specification (and encourage you to make these extensions!) Prior to merging or releasing the mistake, we recommend using git rebase -i to edit the commit history.
🌐
GitHub
gist.github.com › luismts › 495d982e8c5b1a0ced4a57cf3d93cf60
Git Tips and Git Commit Best Practices · GitHub
Save luismts/495d982e8c5b1a0ced4a57cf3d93cf60 to your computer and use it in GitHub Desktop. ... A commit should be a wrapper for related changes. For example, fixing two different bugs should produce two separate commits.
🌐
Medium
medium.com › @iambonitheuri › the-art-of-writing-meaningful-git-commit-messages-a56887a4cb49
The Art of Writing Meaningful Git Commit Messages | by theurikarue | Medium
August 14, 2024 - Clear commit messages serve as a roadmap for future developers, making it easier to track changes and understand the project’s evolution…
🌐
Reddit
reddit.com › r/learnprogramming › best practices for writing git commit messages?
r/learnprogramming on Reddit: Best practices for writing Git commit messages?
December 18, 2025 -

Hi developers,

I’m learning Git and GitHub, and I’m wondering about best practices for writing commit messages. I often write things like “I did XYZ, or I added image of cow with changes to xyz” but in a real production or work environment, what’s the recommended way to write clear, professional commit messages?

Top answer
1 of 18
66
Often commit messages are tied to one or another Jira ticket or such. For example "ZOO-123: Fix to RabbitMQ binder names." This ties that commit with Jira ticket ZOO-123 that either is about changes to RabbitMQ messaging or about fixing an issue with said messaging. Also, some companies use conventional commits. It is just a way of formatting your commit message so that automated tools can process commits in an easier way. Read about it from https://www.conventionalcommits.org/en/v1.0.0/ An example would be "fix(ZOO-123): Fix to RabbitMQ binder names." There the fix() keyword shows that the commit was for fixing something. A feat() keyword can be for adding a new feature or for working with some new functionality. For example "feat(SCHOOL-23): Add Japanese language." The commit message itself is often in imperative present tense. For example "Fix to" instead of "Fixed". The commit should give a summary of the change. What was done. Keep it concise and clear. Do not add a whole essay. But also do not just write "Added more changes." Which changes? Why? Read about it from https://blog.devgenius.io/make-a-meaningful-git-commit-message-with-semantic-commit-message-b39a79b13aa3 Avoid frustration and all kind of nonsense in the commits. Yes, when the stuff does not work and your earlier commit did not fix it then writing "Get working already!!!!!" or "wgo8g7tfwo82w37fdto238gd" is not a rational way how to deal with the issue. It is unprofessional. In the previous company I worked at, we had one guy who raged in his commit messages. Avoid adding too many details. Instead of writing "Fix to UserNotificationIntegrationTest, BillingIntegrationTest, BaseIntegrationTest, RabbitMQPublisherIntegrationTest" better pick "Fix to integration tests". Which tests, that can be seen from the git commit itself. Neither go with "Added an email support to UserNotificationService by introducing emailSender() method that uses angus-mail library" just write "Add support to send user notifications via email" Some good and bad examples are in https://chris.beams.io/git-commit Also, it does not really help when you finish your whole project and then add it via a single commit that has a commit message of "Initial commit".
2 of 18
14
What's professional really depends on the workflow used at a job. If the workflow requires pull requests to get anything to the main branch, then you need to make clear PR descriptions while the commit messages are mostly for yourself
🌐
Simple Thread
simplethread.com › home › blog › what makes a good git commit?
What Makes a Good Git Commit? - Simple Thread
August 13, 2021 - Commit early and often – I am a huge proponent of frequent, small commits. I’d much rather see someone err on the side of too many commits, rather than too few. That’s partially from my years of consulting, where the git log can be helpful in explaining billable hours, but it’s also the foundation of other best practices.
🌐
Allspice
learn.allspice.io › docs › git-commit-best-practices
Git commit best practices
That way, they can save the changes ... in-situ rather than forgetting about it. Best practice, however, is to defer the changes and keep a log of the issues so the project changelog can be more coherent....
Find elsewhere
🌐
GitHub
gist.github.com › Aditi3 › a7a1ddd1ecef73dab548f7955210cfff
Git Commit Best Practices · GitHub
feat: add foo support ^--^ ^------------^ | | | +-> Summary(commit message subject line) in present tense | +-------> Type: chore, docs, feat, fix, refac, style, or test ... chore: regular code maintenance and updating grunt tasks etc; no production code change (eg: change to .gitignore file or .prettierrc file)
🌐
GitKraken
gitkraken.com › home › learn › best practices › writing a good git commit message
How to Write a Good Git Commit Message | Git Best Practices
November 14, 2022 - Not only are these steps quick and easy to apply, but your team members will thank you. Another best practice to help you write good Git commit messages is to use imperative verb form.
🌐
Redirect
sethrobertson.github.io › GitBestPractices
Commit Often, Perfect Later, Publish Once—Git Best Practices
Using git log -Sfoo --all and gitk --all --date-order to try and hunt for your commits on known branches. ... Finally, you should check your backups, testing copies, ask the other people who have a copy of the repo, and look in other repos. Everyone always recommends taking backups as best practice, and I am going to do the same.
Top answer
1 of 7
23

I tend to commit as you propose: a commit is a logically connected change set. My commits can be anything from a one-liner to a change in all files (for example add/change a copyright notice in the source files). The reason for change need not be a full task that I am implementing, but it is usually a milestone in the task.

If I have modified something that is not related to my current commit, I tend to do an interactive add to separate out the unrelated changes, too - even when it is a whitespace tidy up.

I have found that commits that simply dump the working state to repository makes them a lot less useful: I cannot backport a bugfix to an earlier version or include a utility functionality in another branch easily if the commits are all over the place.

One alternative to this approach is using a lot of tiny commits inside a feature branch, and once the whole feature is done, do heavy history rewriting to tidy up the commits into a logical structure. But I find this approach to be a time waster.

2 of 7
18

I try and follow these practices in the order...

  1. A commit must not fail a build. Most important!

  2. It should be made of one logical unit of change - whether a single line/character or a whole file/class with corresponding changes in other parts of code, still following #1.

    What is a logical unit of change? In terms of git, if you can specify the changes in the commit message in least number of characters, in one sentence (without ANDs of-course), and you can not break that description further into smaller units, that I call one unit.

  3. Commit message should clearly specify the essence of the commit.

  4. Commit message should be small, typically no greater than 80 chars. Any more elaboration should be part of the description.

🌐
GitLab
about.gitlab.com › topics › version control › version control best practices
What are Git version control best practices?
By adopting these best practices, teams can set the stage for future growth and innovation. ... Small changes decrease the likelihood of integration conflicts because shorter branch separation from main reduces merge issues. Incremental changes help team members easily revert merge conflicts and enable rapid testing with end users to prove solution validity without depreciating whole functionality. What are atomic commits ...
🌐
DEV Community
dev.to › wallacefreitas › best-practices-to-make-a-good-commit-writing-clean-effective-commit-messages-5eg9
Best Practices to Make a Good Commit: Writing Clean, Effective Commit Messages - DEV Community
August 26, 2024 - ↳ git diff: Review the changes you've made before committing to catch any mistakes or unintended modifications. ... The ability to write quality commits greatly improves both the productivity of your team and the maintainability of your codebase. You may produce a clear, intelligible, and helpful project history by adhering to these best practices, writing descriptive messages, utilizing the imperative mood, mentioning pertinent issues, and keeping commits modest and focused.
🌐
Medium
medium.com › @jaimipatel77 › best-practices-for-writing-good-git-commit-messages-6a2709ced31d
Best Practices for Writing Good Git Commit Messages | by Jaimi Patel | Dec, 2023 | Medium | Medium
December 29, 2023 - Writing meaningful and standardized commit messages is important for maintaining a clear and understandable Git history. One commonly used convention is the “Conventional Commits” specification. This…
Top answer
1 of 2
2

The way that Git recommends that committing be done is such that each change is an atomic, logical commit. In other words, it represents one logical change (executed well) and the entire testsuite passes both before and after the change.

One situation in which adding and committing may be done separately is when you're working on perfecting a commit. You may have an initial version of your code which works, but is messy or still has debugging code in it. You can add this change to the index using git add while continuing to refine it in your work tree. If you find that you've broken things, you can roll back to the version in the index and try again. On the other hand, if you find that a change is better, you can add it again, until you're finally ready to commit.

Another, equally valid workflow for this situation is to make multiple commits, one each time the change is an improvement over the last, and then squash them together using git rebase -i or git reset --soft. Which you want to do depends on your preferred development style; they will essentially both produce the same result.

An alternative situation you may want to use git add separately from git commit is when you want to stash only some changes. You can use git add to keep the changes you want in your working tree and then git stash --keep-index to stash the rest of them away.

A question which you didn't ask but which might be on your mind is why the two functions are separate. This is because sometimes when developing you end up with changes from multiple logical commits in your tree and you want to commit only part of them at once, making additional commits for additional logical changes. Being able to add only part of the changes at once means you can commit those, and then add more changes and commit them, and so on.

2 of 2
0

Could you please give me an example from real life experience, where add and commit does not always be done together?

When you add patches.

git add -p will interactively let you choose hunks of patch between the index and the work tree and add them to the index.

This is often done incrementally, file by file.
Then, after review, you commit.

🌐
Perforce Software
perforce.com › blog › vcs › git-best-practices-git-commit
5 Git Best Practices For Git Commit | Perforce Software
With short-term branches, you reduce check-out times, improve traceability, and expedite code reviews. By committing more frequently, you help to eliminate confusion and decrease the chance of a time-consuming merge.
🌐
Graphite
graphite.com › guides › git-commit-message-best-practices
Git commit message best practices
This guide details best practices for writing Git commit messages, leveraging principles from the conventional commits specification.
🌐
W3Schools
w3schools.com › git › git_best_practices.asp
Git Best Practices
Use git status and git diff to review your changes before you commit.