For question 1:
You can try this: $ git config --global core.editor vi
since vi is pre-installed on fresh Ubuntu 12.04
.
From official manual of git config
:
core.editor
Commands such as commit and tag that lets you edit messages by
launching an editor uses the value of this variable when it is set,
and the environment variable GIT_EDITOR is not set. See git-var(1).
For question 2:
From official manual of git commit
:
--cleanup=<mode>
This option sets how the commit message is cleaned up.
The <mode> can be one of verbatim, whitespace, strip, and default.
The default mode will strip leading and trailing empty lines and
#commentary from the commit message only if the message is to be
edited. Otherwise only whitespace removed. The verbatim mode does
not change message at all, whitespace removes just leading/trailing
whitespace lines and strip removes both whitespace and commentary.
As can see here, the default mode will strip leading and trailing empty lines and #commentary from the commit message only if the message is to be edited.
Other config options that may help:
commit.status
A boolean to enable/disable inclusion of status information in the
commit message template when using an editor to prepare the commit
message. Defaults to true.
and
commit.template
Specify a file to use as the template for new commit messages.
"~/" is expanded to the value of $HOME and "~user/" to the specified
user’s home directory.