Hacker News new | ask | show | jobs
by zheng 5061 days ago
Unless of course you only need to write one line. Not every use of git requires complex formatting in commit messages. Almost all of my git repos are used by me alone, and one line is enough. Obviously this isn't the main purpose of git, but I'm guessing I'm not the only developer using it this way.
3 comments

Additionally, there's significant benefit to lots of tiny commits with a 1 sentence what changed and the squash the commits and write the larger, better formatted one based on your list of one-liners.
I am completely sold on a large series of tiny commits. I am not sold on squashing them together. Why do that?
I frequently have a commit history that looks something like:

    * Add call stub to Foo, add calls to the stub where needed
    * Beginnings of implementation, seems really friggin slow right now.
    * Ok, back to square one, need calls to X, Y and Z, can be chained together, wrap behind the call we actually need.
    * Final implementation
Which I then may leave comments in the code about the obvious approach that didn't work, or why it is the way it is. I then squash this into two commits, first one covering the implementation added to Foo with an appropriate descriptive commit message and a second commit after it that actually uses the new implementation.

Most of the incomplete commits aren't necessary, but we only develop on topic branches and I have a desktop I use at work and a laptop that travels to and from work with me (in case of deciding to work at a coffeeshop, or want to kick back, etc.). The ability to push not-yet-done work to my topic branch makes it available to either computer and the committing when halfway through because it's time to not be at the desk can easily be fixed with squashed commits.

Ah, so we're not talking about taking a whole branch and squashing it into a single 2000 line commit called "Implemented at FooBar" then?

  $ git commit -m "It is possible
  to write a multiline
  commit message
  using the -m flag."
Just hit RET or C-j while you have an open quote and you can send newlines to your heart's content.
I agree with you. It isn't obviously better to write long verbose messages. I commit dozens of times an hour and try and keep each change as small as possible. Ideally, so small a single sentence is a perfect description.

I'm fond of speaking tersely.