I have set a local commit.template in a git repo I manage with SourceTree. When I commit as 'git commit -a', I get a vi editor with the template file (a hidden file in repo root) correctly loaded, as expected. But SourceTree seems to ignore it, and the commit sheet presents an empty commit text area.
Is there a way to have a commit template in SourceTree?
I've just tested this myself and it works fine both from within SourceTree and the command line taking me to vi. I ensured I followed the Git doc guide (rather than doing it my own way). It's better to use $HOME and have a relative link from there rather than an absolute link. So here's what I did:
So in both instances this worked fine. There's a number of reasons this didn't work for you, the git message template not being found, or not existing, or the correct git setting not being set. Perhaps try step 3 above ensuring that it points to a valid file.
Hope that helps
No, it doesn't help, this doesn't work at all. SourceTree just doesn't honor the commit template. I'm using Windows 8 and neither a custom file name, nor a .git_template.txt file as explained here (https://jira.atlassian.com/browse/SRCTREE-982), nor a .gitmessage.txt. It just doesn't work, or it's broken, or never was implemented, choose the one you like at most. Don't point to "user's dumbness" when lots of people say that this doesn't work.
Same problem here. Windows 7, Sourcetree 220.127.116.11, Git 1.9.4
I'm on Windows and I followed the exact same steps you did, @Kieran Senior [Atlassian]. I just omitted $HOME (but still used a relative path), because I wanted my commit template to be specific to my repository and I want it to propagate to other team members, just like my .gitignore file.
Here are my steps:
The words "test template" somewhere in the commit message text area.
The commit message text area was empty.
To verify that the template itself was working, I then performed the following steps:
vi came up with the words "test template" filled in. However, exiting the terminal, closing and re-opening the repository or even restarting Sourcetree had no effect - Sourcetree still presents me with an empty commit message.
I have the same problem where the commit template is showing up fine in a terminal session but not in Source Tree (it's blank). I've verified/tried the following:
1. The entry in the config file is showing the same in Source Tree as it is in a terminal
template = $HOME/.gitcommitmessage.txt
2. I've changed the .gitcommitmessage.txt file to contain nothing but a single word, and that didn't help
3. I tried both --global and non-global when running "git config commit.template $HOME/.gitcommitmessage.txt"
4. I set the config.template to a bogus value and got an error in the terminal, but still blank in SourceTree.
It seems SourceTree isn't reading the config.template setting at all even though I see it when I click on "Edit Config File..."
Hey Community! I’m Shana, a member of our DevOps team here at Atlassian. I wanted to make sure you saw our announcement last week about the launch of Open DevOps since you may have missed it amidst a...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events