tags:

views:

78

answers:

2

In commit messages there is a rule which says:
"Lines starting with '#' will be ignored"

Now I'm confused if these lines is ignored why we use them at all?
running "git log" only shows lines not started by #.and ignored lines is not shown.

Is there any command which shows the lines starting with '#'?

+7  A: 

Well, when you write git commit you normally have to edit a commit message.
And as a reminder there are a lot of # lines, which will show you what will get committed (renamed, new, modified) and what will be ignored. I think that this feature is very useful - but I don't want to see it in my commit message, later.

Example:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
#   (use "git reset HEAD ..." to unstage)
#
#   modified:   file_a.doc
#   deleted:    file_b.jpg
#
# Untracked files:
#   (use "git add ..." to include in what will be committed)
#
#   directory/

I think that's the whole reason for the # lines.

tanascius
Additionally, when the commit is a squash, or an amend, there are extra `#` lines telling you where the different bits of the messages came from.
jleedev
+1  A: 

By 'ignored' it means not saved. The comment lines are just for when you're actually writing the commit message - they don't get saved for later use.

Skilldrick