# Wrap commit messages on `git commit -m`

11 messages from 2012-11-01 to 2012-11-04. Participants: Ramkumar Ramachandra, Thomas Adam, James Nylen, Lars Gullik Bjønnes, Kevin, Jonathan Nieder, David Aguilar, Phil Hord, Tay Ray Chuan.
Thread: https://gitlist.dev/t/31994

## Ramkumar Ramachandra, 2012-11-01 16:07

Subject: Wrap commit messages on `git commit -m`
Message-ID: <CALkWK0kQ+qCsOa87yY4wma279mp+9h+LFv3qCP_qrNdDyGNcsQ@mail.gmail.com>
URL: https://gitlist.dev/e/CALkWK0kQ%2BqCsOa87yY4wma279mp%2B9h%2BLFv3qCP_qrNdDyGNcsQ%40mail.gmail.com

```
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

```

## Lars Gullik Bjønnes, 2012-11-01 16:29

Subject: Re: Wrap commit messages on `git commit -m`
Message-ID: <m3a9v170ca.fsf@black.gullik.net>
URL: https://gitlist.dev/e/m3a9v170ca.fsf%40black.gullik.net
In-Reply-To: <CALkWK0kQ+qCsOa87yY4wma279mp+9h+LFv3qCP_qrNdDyGNcsQ@mail.gmail.com>

```
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

```

## Thomas Adam, 2012-11-01 18:12

Subject: Re: Wrap commit messages on `git commit -m`
Message-ID: <CA+39Oz7iuSPh2DqQFoO9o+V3TouMUy8T00KgXEP0vY758=S5gA@mail.gmail.com>
URL: https://gitlist.dev/e/CA%2B39Oz7iuSPh2DqQFoO9o%2BV3TouMUy8T00KgXEP0vY758%3DS5gA%40mail.gmail.com
In-Reply-To: <CALkWK0kQ+qCsOa87yY4wma279mp+9h+LFv3qCP_qrNdDyGNcsQ@mail.gmail.com>

```
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

```

## James Nylen, 2012-11-01 21:10

Subject: Re: Wrap commit messages on `git commit -m`
Message-ID: <CABVa4Nh_-XD2m4HkPjWBaY8ReJVMbzfn-MC6i-vY-o35xCZUHA@mail.gmail.com>
URL: https://gitlist.dev/e/CABVa4Nh_-XD2m4HkPjWBaY8ReJVMbzfn-MC6i-vY-o35xCZUHA%40mail.gmail.com
In-Reply-To: <CA+39Oz7iuSPh2DqQFoO9o+V3TouMUy8T00KgXEP0vY758=S5gA@mail.gmail.com>

```
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.

```

## Kevin, 2012-11-01 21:52

Subject: Re: Wrap commit messages on `git commit -m`
Message-ID: <CAO54GHDRBDyQYvo-g_xEvsQJRgtfbbT-4-kop8hoSK1D37G44w@mail.gmail.com>
URL: https://gitlist.dev/e/CAO54GHDRBDyQYvo-g_xEvsQJRgtfbbT-4-kop8hoSK1D37G44w%40mail.gmail.com
In-Reply-To: <m3a9v170ca.fsf@black.gullik.net>

```
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

```

## Jonathan Nieder, 2012-11-01 22:12

Subject: Re: Wrap commit messages on `git commit -m`
Message-ID: <20121101221203.GE6213@elie.Belkin>
URL: https://gitlist.dev/e/20121101221203.GE6213%40elie.Belkin
In-Reply-To: <CAO54GHDRBDyQYvo-g_xEvsQJRgtfbbT-4-kop8hoSK1D37G44w@mail.gmail.com>

```
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

```

## Ramkumar Ramachandra, 2012-11-02 19:37

Subject: Re: Wrap commit messages on `git commit -m`
Message-ID: <CALkWK0n3nvu4neica==bXaGCtDish8cfUhcsmJT0w3ihrq6coA@mail.gmail.com>
URL: https://gitlist.dev/e/CALkWK0n3nvu4neica%3D%3DbXaGCtDish8cfUhcsmJT0w3ihrq6coA%40mail.gmail.com
In-Reply-To: <20121101221203.GE6213@elie.Belkin>

```
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

```

## Jonathan Nieder, 2012-11-03 06:38

Subject: Re: Wrap commit messages on `git commit -m`
Message-ID: <20121103063855.GA8326@elie.Belkin>
URL: https://gitlist.dev/e/20121103063855.GA8326%40elie.Belkin
In-Reply-To: <CALkWK0n3nvu4neica==bXaGCtDish8cfUhcsmJT0w3ihrq6coA@mail.gmail.com>

```
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

```

## David Aguilar, 2012-11-03 07:41

Subject: Re: Wrap commit messages on `git commit -m`
Message-ID: <CAJDDKr4ta2Xu5zO6yASSNewZXxu=LWuNO0zU8YnSP4Kq9ZJn-g@mail.gmail.com>
URL: https://gitlist.dev/e/CAJDDKr4ta2Xu5zO6yASSNewZXxu%3DLWuNO0zU8YnSP4Kq9ZJn-g%40mail.gmail.com
In-Reply-To: <20121103063855.GA8326@elie.Belkin>

```
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

```

## Phil Hord, 2012-11-03 18:51

Subject: Re: Wrap commit messages on `git commit -m`
Message-ID: <CABURp0qbX53=bnVDYNmsSixiL+G6B0dg2o8=HR-J4JNanndROw@mail.gmail.com>
URL: https://gitlist.dev/e/CABURp0qbX53%3DbnVDYNmsSixiL%2BG6B0dg2o8%3DHR-J4JNanndROw%40mail.gmail.com
In-Reply-To: <CAJDDKr4ta2Xu5zO6yASSNewZXxu=LWuNO0zU8YnSP4Kq9ZJn-g@mail.gmail.com>

```
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

```

## Tay Ray Chuan, 2012-11-04 07:27

Subject: Re: Wrap commit messages on `git commit -m`
Message-ID: <CALUzUxrdCw6nPLzeLHij+CjHsPO3w=e0nUdjBL=P7rqJtZ+t3A@mail.gmail.com>
URL: https://gitlist.dev/e/CALUzUxrdCw6nPLzeLHij%2BCjHsPO3w%3De0nUdjBL%3DP7rqJtZ%2Bt3A%40mail.gmail.com
In-Reply-To: <m3a9v170ca.fsf@black.gullik.net>

```
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

```
