Git development
 help / color / mirror / Atom feed
* Wrap commit messages on `git commit -m`
@ 2012-11-01 16:07 Ramkumar Ramachandra
  2012-11-01 16:29 ` Lars Gullik Bjønnes
  2012-11-01 18:12 ` Thomas Adam
  0 siblings, 2 replies; 11+ messages in thread
From: Ramkumar Ramachandra @ 2012-11-01 16:07 UTC (permalink / raw)
  To: Git List

Hi,

Some of my colleagues are lazy to fire up an editor and write proper
commit messages- they often write one-liners using `git commit -m`.
However, that line turns out to be longer than 72 characters, and the
resulting `git log` output is ugly.  So, I was wondering if it would
be a good idea to wrap these one-liners to 72 characters
automatically.

Thanks.

Ram

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Wrap commit messages on `git commit -m`
  2012-11-01 16:07 Wrap commit messages on `git commit -m` Ramkumar Ramachandra
@ 2012-11-01 16:29 ` Lars Gullik Bjønnes
  2012-11-01 21:52   ` Kevin
  2012-11-04  7:27   ` Tay Ray Chuan
  2012-11-01 18:12 ` Thomas Adam
  1 sibling, 2 replies; 11+ messages in thread
From: Lars Gullik Bjønnes @ 2012-11-01 16:29 UTC (permalink / raw)
  To: git

Ramkumar Ramachandra <artagnon@gmail.com> writes:

| Hi,
>
| Some of my colleagues are lazy to fire up an editor and write proper
| commit messages- they often write one-liners using `git commit -m`.
| However, that line turns out to be longer than 72 characters, and the
| resulting `git log` output is ugly.  So, I was wondering if it would
| be a good idea to wrap these one-liners to 72 characters
| automatically.

git commit -m 'foo: fix this problem

This problem is fixed by doing foo,
bar and baz.

Signed-off-by: me
'

works.

-- 
	Lgb

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Wrap commit messages on `git commit -m`
  2012-11-01 16:07 Wrap commit messages on `git commit -m` Ramkumar Ramachandra
  2012-11-01 16:29 ` Lars Gullik Bjønnes
@ 2012-11-01 18:12 ` Thomas Adam
  2012-11-01 21:10   ` James Nylen
  1 sibling, 1 reply; 11+ messages in thread
From: Thomas Adam @ 2012-11-01 18:12 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Git List

Hi,

On 1 November 2012 16:07, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
>
> Hi,
>
> Some of my colleagues are lazy to fire up an editor and write proper
> commit messages- they often write one-liners using `git commit -m`.
> However, that line turns out to be longer than 72 characters, and the
> resulting `git log` output is ugly.  So, I was wondering if it would
> be a good idea to wrap these one-liners to 72 characters
> automatically.

Can't you do this already?  From "git-log(1)":

 %w([<w>[,<i1>[,<i2>]]]): switch line wrapping, like the -w
option of git-shortlog(1).

-- Thomas Adam

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Wrap commit messages on `git commit -m`
  2012-11-01 18:12 ` Thomas Adam
@ 2012-11-01 21:10   ` James Nylen
  0 siblings, 0 replies; 11+ messages in thread
From: James Nylen @ 2012-11-01 21:10 UTC (permalink / raw)
  To: Thomas Adam; +Cc: Ramkumar Ramachandra, Git List

On Thu, Nov 1, 2012 at 2:12 PM, Thomas Adam <thomas@xteddy.org> wrote:
> Hi,
>
> On 1 November 2012 16:07, Ramkumar Ramachandra <artagnon@gmail.com> wrote:
>>
>> Hi,
>>
>> Some of my colleagues are lazy to fire up an editor and write proper
>> commit messages- they often write one-liners using `git commit -m`.
>> However, that line turns out to be longer than 72 characters, and the
>> resulting `git log` output is ugly.  So, I was wondering if it would
>> be a good idea to wrap these one-liners to 72 characters
>> automatically.
>
> Can't you do this already?  From "git-log(1)":
>

I think he's talking about git-commit wrapping the message as it is
being committed, instead of git-log doing the wrapping as it is being
displayed.

I personally would rather see git-commit refuse to accept messages
wider than 72 characters.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Wrap commit messages on `git commit -m`
  2012-11-01 16:29 ` Lars Gullik Bjønnes
@ 2012-11-01 21:52   ` Kevin
  2012-11-01 22:12     ` Jonathan Nieder
  2012-11-04  7:27   ` Tay Ray Chuan
  1 sibling, 1 reply; 11+ messages in thread
From: Kevin @ 2012-11-01 21:52 UTC (permalink / raw)
  To: Lars Gullik Bjønnes; +Cc: git

As I see it, the problem is not the possibility to add new lines, but
colleagues being too lazy to add them.

On Thu, Nov 1, 2012 at 5:29 PM, Lars Gullik Bjønnes <larsbj@gullik.org> wrote:
> Ramkumar Ramachandra <artagnon@gmail.com> writes:
>
> | Hi,
>>
> | Some of my colleagues are lazy to fire up an editor and write proper
> | commit messages- they often write one-liners using `git commit -m`.
> | However, that line turns out to be longer than 72 characters, and the
> | resulting `git log` output is ugly.  So, I was wondering if it would
> | be a good idea to wrap these one-liners to 72 characters
> | automatically.
>
> git commit -m 'foo: fix this problem
>
> This problem is fixed by doing foo,
> bar and baz.
>
> Signed-off-by: me
> '
>
> works.
>
> --
>         Lgb
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Wrap commit messages on `git commit -m`
  2012-11-01 21:52   ` Kevin
@ 2012-11-01 22:12     ` Jonathan Nieder
  2012-11-02 19:37       ` Ramkumar Ramachandra
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Nieder @ 2012-11-01 22:12 UTC (permalink / raw)
  To: Kevin; +Cc: Ramkumar Ramachandra, Lars Gullik Bjønnes, git

Kevin wrote:

> As I see it, the problem is not the possibility to add new lines, but
> colleagues being too lazy to add them.

I suspect the underlying problem is that we make it too hard to tell
git which text editor to run.

Ram, what platform do your colleagues use?

Thanks,
Jonathan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Wrap commit messages on `git commit -m`
  2012-11-01 22:12     ` Jonathan Nieder
@ 2012-11-02 19:37       ` Ramkumar Ramachandra
  2012-11-03  6:38         ` Jonathan Nieder
  0 siblings, 1 reply; 11+ messages in thread
From: Ramkumar Ramachandra @ 2012-11-02 19:37 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Kevin, Lars Gullik Bjønnes, git

Jonathan Nieder wrote:
> Kevin wrote:
>
>> As I see it, the problem is not the possibility to add new lines, but
>> colleagues being too lazy to add them.
>
> I suspect the underlying problem is that we make it too hard to tell
> git which text editor to run.

Don't we just use $EDITOR?

> Ram, what platform do your colleagues use?

Red Hat Enterprise Linux 5.

Ram

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Wrap commit messages on `git commit -m`
  2012-11-02 19:37       ` Ramkumar Ramachandra
@ 2012-11-03  6:38         ` Jonathan Nieder
  2012-11-03  7:41           ` David Aguilar
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Nieder @ 2012-11-03  6:38 UTC (permalink / raw)
  To: Ramkumar Ramachandra; +Cc: Kevin, Lars Gullik Bjønnes, git

Ramkumar Ramachandra wrote:
> Jonathan Nieder wrote:

>> Ram, what platform do your colleagues use?
>
> Red Hat Enterprise Linux 5.

Oh, ok.  In that case I blame habit.

I think the best option you have is to just complain to your
colleagues about the long lines.  Then they would get a chance to
explore what the UI currently offers and to complain to this list
(perhaps via you :)) about missing features that would make their work
easier.

To put it another way: I don't see yet how a hypothetical "git commit
--wrap-lines -m 'long message'" would make life easier than just
running "git commit" and entering the message using $EDITOR.  There's
probably a UI or documentation bug lurking somewhere, so thanks for
thinking about these things.

Regards,
Jonathan

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Wrap commit messages on `git commit -m`
  2012-11-03  6:38         ` Jonathan Nieder
@ 2012-11-03  7:41           ` David Aguilar
  2012-11-03 18:51             ` Phil Hord
  0 siblings, 1 reply; 11+ messages in thread
From: David Aguilar @ 2012-11-03  7:41 UTC (permalink / raw)
  To: Ramkumar Ramachandra
  Cc: Kevin, Lars Gullik Bjønnes, git, Jonathan Nieder

On Fri, Nov 2, 2012 at 11:38 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Ramkumar Ramachandra wrote:
>> Jonathan Nieder wrote:
>
>>> Ram, what platform do your colleagues use?
>>
>> Red Hat Enterprise Linux 5.
>
> Oh, ok.  In that case I blame habit.
>
> I think the best option you have is to just complain to your
> colleagues about the long lines.  Then they would get a chance to
> explore what the UI currently offers and to complain to this list
> (perhaps via you :)) about missing features that would make their work
> easier.
>
> To put it another way: I don't see yet how a hypothetical "git commit
> --wrap-lines -m 'long message'" would make life easier than just
> running "git commit" and entering the message using $EDITOR.  There's
> probably a UI or documentation bug lurking somewhere, so thanks for
> thinking about these things.
>
> Regards,
> Jonathan

If your colleagues do not mind using a GUI then git-cola
might help them form better commit messages.

It auto-wraps long lines and enforces a very clear distinction
between the one-line summary and extended description.
-- 
David

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Wrap commit messages on `git commit -m`
  2012-11-03  7:41           ` David Aguilar
@ 2012-11-03 18:51             ` Phil Hord
  0 siblings, 0 replies; 11+ messages in thread
From: Phil Hord @ 2012-11-03 18:51 UTC (permalink / raw)
  To: David Aguilar
  Cc: Ramkumar Ramachandra, Kevin, Lars Gullik Bjønnes, git,
	Jonathan Nieder

On Sat, Nov 3, 2012 at 3:41 AM, David Aguilar <davvid@gmail.com> wrote:
> On Fri, Nov 2, 2012 at 11:38 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
>> Ramkumar Ramachandra wrote:
>>> Jonathan Nieder wrote:
>>
>>>> Ram, what platform do your colleagues use?
>>>
>>> Red Hat Enterprise Linux 5.
>>
>> Oh, ok.  In that case I blame habit.
>>
>> I think the best option you have is to just complain to your
>> colleagues about the long lines.  Then they would get a chance to
>> explore what the UI currently offers and to complain to this list
>> (perhaps via you :)) about missing features that would make their work
>> easier.
>>
>> To put it another way: I don't see yet how a hypothetical "git commit
>> --wrap-lines -m 'long message'" would make life easier than just
>> running "git commit" and entering the message using $EDITOR.  There's
>> probably a UI or documentation bug lurking somewhere, so thanks for
>> thinking about these things.
>>
>> Regards,
>> Jonathan
>
> If your colleagues do not mind using a GUI then git-cola
> might help them form better commit messages.
>
> It auto-wraps long lines and enforces a very clear distinction
> between the one-line summary and extended description.

vim also does this nicely with syntax highlighting turned on, though I
do not know how this feature is triggered.

Specifically, it wraps all lines at 72 characters; it colors line 1
yellow out to 50 characters and white after that; and it colors any
text on line 2 with a red background (should be empty).

Phil

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: Wrap commit messages on `git commit -m`
  2012-11-01 16:29 ` Lars Gullik Bjønnes
  2012-11-01 21:52   ` Kevin
@ 2012-11-04  7:27   ` Tay Ray Chuan
  1 sibling, 0 replies; 11+ messages in thread
From: Tay Ray Chuan @ 2012-11-04  7:27 UTC (permalink / raw)
  To: Lars Gullik Bjønnes; +Cc: Ramkumar Ramachandra, git

On Thu, Nov 1, 2012 at 11:29 AM, Lars Gullik Bjønnes <larsbj@gullik.org> wrote:
> Ramkumar Ramachandra <artagnon@gmail.com> writes:
>
> | Hi,
>>
> | Some of my colleagues are lazy to fire up an editor and write proper
> | commit messages- they often write one-liners using `git commit -m`.
> | However, that line turns out to be longer than 72 characters, and the
> | resulting `git log` output is ugly.  So, I was wondering if it would
> | be a good idea to wrap these one-liners to 72 characters
> | automatically.
>
> git commit -m 'foo: fix this problem
>
> This problem is fixed by doing foo,
> bar and baz.
>
> Signed-off-by: me
> '
>
> works.

Perhaps a deeper issue is that the implicit email format
(subject-body) for commit messages, is, well, implicit. New users of
git who type git-commit -m '...' isn't going to know that those few
characters will all be lumped on a "subject" line, forever screwing
themselves when they review the output of git-log, git-rebase
--interactive, etc. (can't remember off the top of my head if
git-format-patch would chop off long subjects and move it to the
body), which may be a significant period of time (and thus commits)
later.

While I don't have any ideas on how to improve on this, hopefully this
gets recognized as an issue in the first place.

-- 
Cheers,
Ray Chuan

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-11-04  7:28 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-01 16:07 Wrap commit messages on `git commit -m` Ramkumar Ramachandra
2012-11-01 16:29 ` Lars Gullik Bjønnes
2012-11-01 21:52   ` Kevin
2012-11-01 22:12     ` Jonathan Nieder
2012-11-02 19:37       ` Ramkumar Ramachandra
2012-11-03  6:38         ` Jonathan Nieder
2012-11-03  7:41           ` David Aguilar
2012-11-03 18:51             ` Phil Hord
2012-11-04  7:27   ` Tay Ray Chuan
2012-11-01 18:12 ` Thomas Adam
2012-11-01 21:10   ` James Nylen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox