gitcommithook

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2018 License: MIT Imports: 6 Imported by: 0

README

git-commit-hook

Go Report Card License Linux build Windows build Coverage Status

Problem: I forget to add ticket numbers to commit messages or I take the wrong ticket ID.

Solution: a custom git-hook that prepends the current branch-name to every commit message.

The implementation and rules are tightly coupled to git flow used with jira.

The intention is on the one hand to make life easier when working on features. On the other hand the intention must be to not allow commits to non-fetaure branches without having a valid ticket reference.

So here are the rules
  • At least there must always be a non empty commit message.

  • When you are committing to a feature branch

      the hook will preprend the branch name to the commit message
    
  • When you are committing to a non feature branch, lets say develop for a quick fix, release/v0.1.1 for a release fix or a hotfix

      you have to enter a valid feature reference.
    

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFeatureBranch

func IsFeatureBranch(commitMessage string) bool

IsFeatureBranch detects weatcher the input matches one of the defined patterns

func ModifyGitCommitMessage

func ModifyGitCommitMessage(gitCommitMessage string) (modifiedCommitMessage string, err error)

ModifyGitCommitMessage prepends the current branch name to the given git commit message. if the current branch name is detected to be NO feature branch, the user will be prompted to enter a feature branch manually. This is then inserted in between current branch and commit message. If no valid branch name could be determined the function returns an error

func RewriteCommitMessage

func RewriteCommitMessage(commitMessageFile string) error

RewriteCommitMessage rewrites the commit message in the given commit message file

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL