Earlier quoted context omitted.
I think you can do that in a merge commit, sort of. The more I think about it, the stranger a strong aversion to rewriting commit history for clarity is. In university if I did some math / physics calculation, I would often start, and once I got somewhere, make a clean copy of the successful work to have a concise and revised version.
I am a firm believer that it's totally fine to rewrite history when working on a private branch that hasn't been pushed.
How to Write a Git Commit Message (2014)
51–60 of 121 posts
Re: How to Write a Git Commit Message (2014)
#52Useful things to have in a commit message: - Test plan when there's no unit test (describes how to test that the patch actually works). - Task ID (link to whatever is used to track tasks/bugs, as there's usually more context there). - Blame rev when a patch fixes a bug, it's useful to know which commit introduced the bug.
Re: How to Write a Git Commit Message (2014)
#53My personal, subjective impression: Commits are getting smaller and smaller nowadays. As in: In the subversion days, many people commited only few times a day, sometimes not for several days. SVN commits of course involved a sync with the server (a "push" in git lingo), and thus usually represented a much larger increment with a substantial change to the code base [X] With git, it became very common to structure chan…
I find tons of small commits a clutter and waste of time. I don't see any reason for doing so. On the contrary I can see disadvantage - reading and understanding a history later may become difficult task. After all what counts is your full chunk of work, reviewed via pull request, and merged to master. It should be treated as a whole. Has it really become so common with git? I don't see such trend around me.
I'm replying to you but this is directed at everybody who advocates squash merge and discourages small commits.
IMO this is a tooling problem, plain and simple. When I am committing to Git, I am using the "write" components of Git which are incredibly powerful. I can commit in as small a chunk as I want and preserve the richest history of all the small changes I've made, knowing full well that the state of the code at HEAD will not be degraded for doing so. If I make two small independent changes, I can feel free to branch them separately and then merge them together to show that they could have been performed in any order.
When you read my history, you are using the "read" components of Git. Unfortunately these are not as powerful. You can do some nice things, like if you want to treat history as a straight line you can use `git log --first-parent` and you'll see only the merge commits (as if all merges had been squash-rebases).
It would be much better if you were able to collapse or expand any sequence of linear commits to gloss over the lower level details. But as far as I'm concerned, this is a problem with the "read" components of Git, not the "write" components, and so I will continue to use the "write" components to their full power. And the best part is that if I do it this way, we can improve the "read" components and allow the reader to collapse my verbose history, but we will never be able to expand pre-collapsed history.
Re: How to Write a Git Commit Message (2014)
#54Git has zero opinion on when you commit or what the messages are. Commits are made in private. Commits are also immutable. This is a losing battle. If you use a code management tool like BitBucket or GitHub, it seems like the unit of work is less a commit and more a PR. A PR's description can always be edited and refined for future engineers, and a PR (almost) always represents a block of work that can be reverted. I…
Re: How to Write a Git Commit Message (2014)
#55Re: How to Write a Git Commit Message (2014)
#56My personal, subjective impression: Commits are getting smaller and smaller nowadays. As in: In the subversion days, many people commited only few times a day, sometimes not for several days. SVN commits of course involved a sync with the server (a "push" in git lingo), and thus usually represented a much larger increment with a substantial change to the code base [X] With git, it became very common to structure chan…
> What I do miss however, is a good description of the overall change. https://github.com/ribasushi/dbix-class/commit/1cf609901 Something like that I take it? :)
Re: How to Write a Git Commit Message (2014)
#57He mentions using the imperative mood for the subject line, but doesn't anyone else think it makes more sense and sounds better to use the present tense, e.g. Opens the pod bay doors Instead of Open the pod bay doors ?
Re: How to Write a Git Commit Message (2014)
#58The most important tip is "Use the body to explain what and why vs. how". I'd also say: remove thw -m option from git and force people to open the editor. Do not accept messages shorter than 3 lines, start the editor with a template Title What changed and why it changed.
From SO: >Git can take the commit message from a file using the -F or --file flags: >git commit -F message.txt So something like echo 'pmontra\n say\n this\n should be several lines' | git commit -F /dev/stdin would get around your block.
echo is a very non-portable command. POSIX says: "if any of the operands contain a character, the results are implementation‐defined."
Re: How to Write a Git Commit Message (2014)
#59My team uses a git commit message convention that helps us read fast and also is parsable by toolchains. We agree on a short list of leading active verbs: Add = Create a capability e.g. feature, test, dependency. Cut = Remove a capability e.g. feature, test, dependency. Fix = Fix an issue e.g. bug, typo, accident, misstatement. Bump = Increase the version of something e.g. dependency. Make = Change the build process,…
Re: How to Write a Git Commit Message (2014)
#60How to write good git commit messages literally from the person who wrote git (Linus Torvalds): https://github.com/torvalds/subsurface-for-dirk/blob/0f58510... I always send this to people as I teach them git.