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?
Same problem here. Windows 7, Sourcetree 1.6.8.0, 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:
Expected:
The words "test template" somewhere in the commit message text area.
Actual
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.
Hey Carl. Could you open an issue on jira.atlassian.com and link back to here? Us devs don't really come on AAC any longer due to time constraints. Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Paolo,
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This worked just fine in OSX. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
[commit]
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..."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.