Re: commiting a change from command line with newlines.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jul 03, 2020 at 01:22:09AM -0300, Tomas wrote:
> Hello,
> 
> I'm trying to write stanzas in my commit message, and naturally the ASCII newline character is the best tool for this, beautifully integrated throughout my whole system, from my keyboard to my screen.
> 
> My question is, how can I add a newline from the git command line without opening an external program like vi, atom, notepad, word etc...
> 
> Since I'm using a unix like system I even tried with pipes (and xargs, the necessary evil) but with something like "printf "a\nb" | xargs git commit -m" b gets interpreted as something else. 
> 
> Does anybody know of a way to adorn a commit message with newlines in a single git commit command? 
> Thanks in advance.
> 

git commit accepts multiple `-m` arguments, where each message will be
concattenaed with two newline characters.

So `git commit -m "add foo to bar" -m "foo is necessary to allow bar to
..." -m "baz would not work in this case because.."`

Would turn out as:

> add foo to bar
>
> foo is necessary to allow bar to...
>
> baz would not work in this case beacuse..

Hope this helps,

Kevin



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux