DEV Community

Discussion on: Do your commits pass this simple test?

beyrem_makh profile image
beyrem Makhlouf

Yes
But if your branch live for days, we may stay need to have multiple commit
I used to revert my own code before merging my PR

Thread Thread
stargator profile image
Stargator

To continue on @beyrem_makh 's point, even if you know your commits will be squashed if you ever need to revert a commit, drop it, or edit it then having clear commit messages would be helpful.

For example, if I've been working on a branch for a few days, but another task is dependent on those changes before it can get started. Then another developer may branch off of my branch and start their work.

Some time later, my branch is squashed into master. But before the second branch can be squashed in, that author will need to know which commits were for one task and not the other.

If neither developer worked on both branches, than it's easier to tell.

But if either of them did or both tasks on worked on by the same person, then having a clear commit message is critical.

On my teams, we include the task number we are working on in the commit message. Always the first thing typed out.