gitcomm

package module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: MIT Imports: 10 Imported by: 0

README

GoDoc Go Report Card

Git commit message formatter

Cli app to implement git message template
Automate your commit message workflow with some rules

The name 'gitcomm' is short 'git commit message'.

Usage:

demo

Download and install it:

$ go get -u -d github.com/karantin2020/gitcomm/cmd
$ go install -o gitcomm github.com/karantin2020/gitcomm/cmd

Or install precompiled release binary.

Usage: gitcomm [-v] [-Ast] | [-u]

Automate git commit messaging

Source https://github.com/karantin2020/gitcomm
                  
Options:          
  -V, --version   Show the version and exit
  -A, --addAll    Adds, modifies, and removes index entries to match the working tree. Evals `git add -A`
  -v, --verbose   Switch log output
  -s, --show      Show last commit or not. Evals `git show -s` in the end of execution
  -t, --tag       Create an annonated tag for the next logical version
  -u, --undo      Revert last commit
# type(<scope>): <Subject>

# <Body>

# * <Footer>
Type should be one of the following:
  • feat (new feature)
  • fix (bug fix)
  • docs (changes to documentation)
  • style (format, missing semi colons, etc; no code change)
  • refactor (refactor production code)
  • test (add missing tests, refactor tests; no production code change)
  • chore (update grunt tasks etc; no production code change)
  • version (description of version upgrade)

Scope is just the scope of the change. Something like (admin) or (teacher).
Subject should use imperative tone and say what you did.
The body should go into detail about changes made. Use the body to explain what and why vs. how
The footer should contain any git issue references or actions.

Issue Processing

ISSUE_KEY #comment This is a comment
ISSUE_KEY #resolved

Template is from this repo https://github.com/williampeterpaul/.git-commit-template

Follows this https://chris.beams.io/posts/git-commit/
The seven rules of a great Git commit message

Keep in mind: This has all been said before.

  1. Separate subject from body with a blank line
  2. Limit the subject line to 72 characters
  3. Capitalize the subject line
  4. Do not end the subject line with a period
  5. Use the imperative mood in the subject line // That rule is for user impl
  6. Wrap the body at 72 characters. Limit the body length to 320 characters
  7. Use the body to explain what and why vs. how // That rule is for user impl

Example commit message:

Redirect user to the requested page after login

https://trello.com/path/to/relevant/card

Users were being redirected to the home page after login, which is less
useful than redirecting to the page they had originally requested before
being redirected to the login form.

* Store requested path in a session variable
* Redirect to the stored location after successfully logging in the user

Source is https://robots.thoughtbot.com/5-useful-tips-for-a-better-commit-message

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoTag

func AutoTag(level string)

AutoTag creates an annonated tag for the next logical version

func CheckForUncommited

func CheckForUncommited() bool

CheckForUncommited function checks if there are changes that need commit

func CheckIfError

func CheckIfError(err error)

CheckIfError should be used to naively panics if an error is not nil

func CheckIsGitDir

func CheckIsGitDir() bool

CheckIsGitDir function checks is dir inside git worktree

func ExitIfError

func ExitIfError(err error)

ExitIfError exits with status 1 if an error is not nil

func GitExec

func GitExec(addAll, show bool, msg string)

GitExec function performs git workflow

func Info

func Info(format string, args ...interface{})

Info should be used to describe the example commands that are about to run.

func Prompt

func Prompt() string

Prompt function assignes user input to Message struct

func PromptConfirm

func PromptConfirm(msg string) bool

PromptConfirm is a common function to ask confirm before some action

func TagPrompt

func TagPrompt() string

TagPrompt prompting tag version level to upgrade

func UndoLastCommit

func UndoLastCommit()

UndoLastCommit leaves your working tree (the state of your files on disk) unchanged but undoes the commit and leaves the changes you committed unstaged

Types

type Message

type Message struct {
	// Type message field
	Type string
	// Subject message field
	Subject string
	// Body message field
	Body string
	// Foot message field
	Foot string
}

Message type holds all commit message fields

func (Message) String

func (m Message) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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