When using commit.template config (see https://answers.atlassian.com/questions/143622/git-config-commit-template-apparently-not-working) SourceTree reads the template file just fine. When committing, it doesn't ignore lines starting with '#' though, as it was designed by git.
In the terminal, when committing with a message that contains lines starting with a '#', git ignores those lines and does not make them part of the actual commit message. SourceTree on the other hand makes them part of the actual commit message.
Is this behaviour wanted? If yes, why?
I want commit message templates that explain where what goes, specifying keywords that dynamically interact with a project management platform (Redmine, http://www.redmine.org/projects/redmine/wiki/RedmineSettings#Referencing-issues-in-commit-messages) as comments that should be ignored in the actual commit message.
I'm currently working with SourceTree 18.104.22.168 on Windows 8 and system Git version 1.9.0
And the reason can be found in the documentation for the commit.cleanup option:
Strip leading and trailing empty lines, trailing whitespace, commentary and collapse consecutive empty lines.
stripexcept #commentary is not removed.
stripif the message is to be edited. Otherwise
The crucial part is "is to be edited" in the description of the default setting.
When committing from the command line and letting Git open an editor the mode used will be "strip". But if you supply the commit message using "-m" or "-F" the "whitespace" mode will be used.
By looking at "Show Full Output" when committing from SourceTree you can see that the commit message is saved to a temporary file and supplied to Git using the "-F" option.
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Heya, Hipchat friends! We’re so happy you’re checking out Stride. Whether you know it or not, you have been instrumental in making Stride come to life. Every feature, design, and functionality...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs