Git Extensions has a feature called commit templates that I use a lot when committing code to make sure that the number of characters per line never exceeds a certain maximum and that the second line is always blank, basically so that my commit messages are well formed.

I have only 1 commit template set, but I still have to manually select it when committing. Is there any way to have this commit template automatically selected when I start a new commit?

有帮助吗?

解决方案

This isn't possible in Git Extensions. The commit panel maintains its state and cannot default to any value. As an example, open the commit window and type "This is my commit text" or some arbitrary message into the commit area, then close the window and the entire application without doing the commit. After you restart the application, the text will still be in the commit area. This can be pretty useful, but as a side effect of maintaining state, it appears we lose out on any sort of defaults besides a blank message.

The only workaround I know of is clone the Git Extension code repo and add the feature yourself and request that it be included in future versions. Might be more work than it's worth for you.

其他提示

For GitExtensions > 2.50.02 you can add a template under Tools -> Settings -> Git Config -> Path to commit template

and add whatever path you want. You can toggle the Settings source under the same window to effect all repos or just your local repo.

Alternatively if you want to use the command line instead you could do:

$ git config --global commit.template <path_to_your_.txt_template_file>

like mentioned here

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top