jaroslavtyc / y_git-commit-autoprefix

Automatic prefixing of GIT commit messages by JIRA issue code (or whatever you dream up).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

For automatic prefixing of GIT commit messages by JIRA (or whatever you dream up) issue code.

That is suitable for pairing commits at bitbucket.org with JIRA issues.

Example
Usage
Hints

Example

$ git branch
* FOO-123-bar-baz

(the JIRA project key is FOO)

$ git commit -m "qux"

(commit message without any prefix)

$ git log
EXPOLD-123 qux

(commit message has been autoprefixed by project key, parsed from GIT branch name)

All the magic is made by GIT commit_msg hook

Usage

Master branch is for Linux bash format. For OSX use the osx-compatible branch instead.

  • copy the file hooks/commit-msg into your own project, versioned by GIT, into project subdirectory .git/hooks
  • preserve the name of the file (commit-msg), or merge the content with existing one
  • change strings FOO, BAR, BAZ in the file to your JIRA project key (optional: delete the unused project key strings, including trailing pipes |)
  • checkout (or create) a GIT branch in your project with name prefixed by corresponding JIRA issue (that means with preceding JIRA project key, like FOO-123-fix-user-color-settings)
  • commit something with a commit message, like "fix: used background color respects use settings"
  • look to commit history, by git log for example, and observe the last commit message, it should be like "FOO-123 fix: used background color respects use settings"

Hints

Did you know you can share same GIT branch with more JIRA issues?

  • just prefix the branch name by issue codes, like FOO-123-BAR-789-baz
  • the hook will take care about proper prefixing of your commits (since commit ad93fcaaa7f199617f5ca7839849c9668266d221, 2015-01-20)
Border by remaining merged branches?

After branch merge via bitbucket and its pull request, the branch can be removed on server.

But what about you and your local?

Try git up, one save command solve this and something more.

About

Automatic prefixing of GIT commit messages by JIRA issue code (or whatever you dream up).

License:MIT License


Languages

Language:Shell 100.0%