1

I want commit with message and Extended description text to Bitbucket server. It exists on Git-cola software and I need the command line of it. I am using ubuntu and I need terminal command for Extended description

git commit -am "My commit text" "My Extended description is this. Containing break lines in it."
Vidya Sagar
  • 1,677
  • 3
  • 15
  • 27
Huseyin
  • 1,407
  • 2
  • 24
  • 38

2 Answers2

3

There is no "extended description" concept in git. Only the commit message. What happens is that the commit message can have a single line or multiple lines.

External tools or websites such as git-cola or GitHub can interpret multiple lines commit messages as:

  • The first line is a short description
  • All the other lines are an extended description

For one line messages, only the "short description" is defined.

See GitHub commit with extended message for details.

As ckruczek suggested you can simply git commit without option and a text editor will spawn, just write the first line as the short description and the rest as the extended description.

If you want to do it from the command line, you can use one of the options mentionned in this question: Add line break to git commit -m from command line.

For example with bash, you can do:

git commit -m 'Message
goes
here'

Or use the "here document" syntax:

git commit -F- <<EOF
Message
goes
here
EOF

PS: Examples are taken directly from the answer in Add line break to git commit -m from command line. Credits for Simon Ritcher and jpmc26.

As a third way, you could also use a temporary file:

echo $comment > message.tmp
echo $extended >> message.tmp
git commit -F message.tmp
rm message.tmp

There is also another option (also described in this question answer): You can specify multiple messages using the '-m' option multiple times:

git commit -m "Short description" -m "Extended description"

Be careful as, specified this way, messages will be treated as paragraph, thus beeing separated by an empty line.

From the online git doc:

-m <msg>
--message=<msg>

Use the given <msg> as the commit message. If multiple -m options are given, their values are concatenated as separate paragraphs.

Community
  • 1
  • 1
superbob
  • 1,478
  • 12
  • 23
2

When you git commit, you get an editor. The first line is the subject of the commit and should be a short description (less than 50 characters) in the present continuous tense. Then a new line and an "extended description" which should contain more details wrapped to 72 columns. This is probably what git cola is doing is doing under the hood. http://chris.beams.io/posts/git-commit/ is a nice article on the structure of a commit message.

Noufal Ibrahim
  • 66,768
  • 11
  • 123
  • 160