GitSavvy icon indicating copy to clipboard operation
GitSavvy copied to clipboard

Commit Message Templates

Open divmain opened this issue 9 years ago • 4 comments

  • [ ] add GitSavvy.sublime-settings option commit_template that accepts a string
  • [ ] when set, this string will be used to pre-populate the commit window on new commits
  • [ ] user should be able to define tab-stops (similar to how snippets work), so that they can tab between the "fields" that need to be filled out

divmain avatar Feb 26 '16 10:02 divmain

Maybe we should use git's commit template? loot at setting commit.template

stoivo avatar Feb 27 '16 09:02 stoivo

Hey,

I use the "commit_help_extra_file": option to set the commit message that I am supposed to use. However, the commit screen (and the amend commit screen for that matter) ends up showing the GitSavvy's help message anyway.

Is there a way to disable this?

Cheers! Bharath ಭರತ

bharath144 avatar Apr 13 '16 04:04 bharath144

@divmain It's a very useful feature. In my team we have to add branch name manually to every commit.

pokidovea avatar Jul 12 '17 08:07 pokidovea

A complete hack but the following works to get a jira prefix added to all commits. Install gitsavvy as a git repo as described in readme. edit ~/.config/sublime-text-3/Packages/GitSavvy-master/core/commands/commit.py

line 26, add a default prefix/marker

        COMMIT_HELP_TEXT = """JIRA-1234

line 133, add move cursor to end of prefix

        self.view.run_command("gs_replace_view_text", {
            "text": initial_text,
            "nuke_cursors": True
            })
    self.view.run_command("move_to", {"to": "eol"})

There does not seem to be a way to force a reload of the plugin without a restart so make a simple bash function to set the current task id you are working on and restart sublime.

function git_template {
	sed -i -e "s/JIRA-[[:digit:]]*.*/JIRA-$1 /" ~/.gitmessage
        sed -i -e "s/JIRA-[[:digit:]]*.*/JIRA-$1 /" ~/.config/sublime-text-3/Packages/GitSavvy-master/core/commands/commit.py
        kill $(pgrep sublime -U <user>)
        subl &
}

Now simply run git_template 5678 and enjoy :-)

hjuva avatar Nov 02 '17 14:11 hjuva