Why doesn't git gui follow the comment lines added by the git hook?

I wrote a hook-commit-msg that maps Team Foundation Server Server ID to a Git commit message. (When you commit, a selection list appears. Users can select one or more work items, and work items are added to the commit message using a specific format. Later we use Git log -grep to search for specific commits belonging to the work case).

I use the comments in the commit message to give additional information to the user. For example, when Team Foundation Server is unavailable, I add the following comment at the beginning of the commit message.

# Warning: could not access Team Foundation Server at <servername>.

Since the line starts with the # sign, it is not added to the actual commit message ... when using Git commit.

If I use Git gui, the comment appears in the Git GUI, but is actually added to the Git commit message when committed.

Is there a specific reason that Git gui actually adds lines starting with the # sign? I expected him to ignore these lines.

+3
source share
1 answer

Git has no comments at all in such commit posts. What you mean is a special feature git commit -e, which is the default if -m or -F are not used.

git gui, git commit -mand git commit -Feveryone accepts the commit message as exactly what they were given.

hook-commit-commit-msg , , commit-msg, . commit-msg .

+2

Source: https://habr.com/ru/post/1788155/


All Articles