How can I specify a multiline commit message for mercurial on the command line?
hg commit -m "* add foo\n* fix bar"
does not work. The log shows:
changeset: 13:f2c6526e5911
tag: tip
date: Fri Jan 23 23:22:36 2009 +0100
files: foobar.cpp
description:
* add foo\n*fix bar
Here's another way that is more close to what you tried at first:
Hit enter.
One of the things is that only the first line shows up in hg log:
... but if you fire up "hg view" you can see that the whole message is there.
Edited to add:
... but hg -v log shows the whole message:
From Windows cmd, do this command for a multiline commit.
This allows you to enter a multiple line commit message straight from the command line. To end your message, hit Enter, and on a line by itself hit Ctrl + Z and Enter again.
Why? The
-l
option tohg commit
says to read the commit message from a file, andcon
specifies that the file is actually the console.For Windows with PowerShell:
If you're doing it interactively (vs. from a script), just do
hg commit
without the -m flag. I'm not sure what the behavior is on Linux or Mac, but on Windows it pops up Notepad with a file that you fill out and save for a multiline message.I know, there is already a solution for linux users, but I needed another solution for windows command line, so I was looking for it...
And I found one: https://www.mercurial-scm.org/pipermail/mercurial/2011-November/040855.html
I hope, it's useful for someone out there ,)
[EDIT] oO - it has already been added to the help