Four rules for effective collaboration – Guidelines for better commits
github.com
github.com
Why is this change necessary? What assumptions is it based on? Were any alternative solutions considered? Why was this solution chosen from among the alternatives? Are there any non-obvious implications that this change has?
But none of the proposed rules actually answer those 5 questions in their explanation.
Sometimes the extra time and effort is already made up for in the review process, which without proper context could drag out and cause a lot of back and forth. Sometimes it might save somebody hours and days of investigation time. This is not to mention the benefits that both the author and the readers of the commit get by better understanding both the problem and the solution.
Anyway good luck fixing anything trusting commit messages from long time ago. Code is truth and if you won't investigate you still don't know how it works.
It's more work for you, but it saves the rest of the team even more time. It helps the dev reading it in three years understand, when he git blames to figure out why you did this strange thing.
If you have never used tools that can automatically link commit messages to stories you are truly missing out.
One rule for how to effectively collaborate - talk to the people you are trying to collaborate with about expectations and then follow them. Try to remember along the way that you are all human.
Pick a standard example, go with that, evolve. Same with e.g. processes, pick e.g. scrum, do it by the book at first, evolve.
I've started at half a dozen projects and every time a huge amount of time is being spent (wasted) on reinventing the wheel, be it processes, version control, code style, etc.
"Every commit should be complete." and "Every commit should only do a single thing." and then make it in a way that someone could actually review changes. In most cases it is not possible, more often it is complete or does single thing.
Not only that but the ticket is a full feature. Maybe it took 5 commits to get there: "Fix bad indenting", "Extract base logic to command object", "Update I18N entries", "Add missing tests for current behavior", "Add the feature asked for".
The way it is described in article would make you do it in one commit and add information that would be in the ticket.
First you must convince people that the obviousness of their commits decays rapidly. What was obvious ten commits ago will be completely opaque three hundred commits from now.
Then you must convince them that the descriptions of the commits are often instrumental in fixing bugs without introducing regressions.
And to do both of these you must convince them that this code will survive for a long time. Everyone behaves like they won’t be here for the consequences or like they can “fix it later”. One of those tomorrows never comes.
$ git log --oneline | cut -c 1-7 | sort | uniq -c | grep -v ' 1 '
2 1536dd9
2 191f241
2 2e6e3e8
2 3b130ad
2 d53a350How many commits is the repo you're running this on btw?
Long to short, why can't this be a form of some sort? Engineers / developers have enough to worry about, why add more minutia to the pile?
The CL is not an adequate OSFA solution. If quality and quantity is a concern, when is that going to be addressed?
There is also pulling commit messages from a file. The commit -F /path/to/file switch allows you to specify a file that Git will pull text from. I try to write my commit messages before I make a change, because it helps me ensure that everything I'm working on satisfies the single-thing-per-commit rule. I always update the same file, so I made it an alias:
git config --global alias.commit-txt 'commit -F ~/commit.txt'
Edit: If you're unfamiliar with how aliases work, you create one with the above invocation. The portion after alias. is the command you define and want to type. The portion in single-quotes is the actual git command. Thus, you'd type $ git commit-txt
to use the above command. What the command line sees is $ git commit -F ~/commit.txtIt can! See Commitizen and its cli, used by e.g. the Angular project, which offers a cli wizard for filling in a commit message - type (fix, feature, chore, ci, doc, etc), scope (depends on project, one word category), short description, backwards-incompatble changes, etc; see http://commitizen.github.io/cz-cli/. This system can then be used to generate changelogs and do semantic versioning compatible version bumps - patch releases if the diff since the last tag only contains 'fix', minor if it contains 'feat', major if it contains backwards incompatible changes.