Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

Commit

Permalink
chore: Create a git commit message template and apply it to new commi…
Browse files Browse the repository at this point in the history
…ts (vuetifyjs#2124)

* chore: Create a git commit message template and apply it to new commits

This will help everyone create more descriptive commit messages, and
hopefully reduce the number of unrelated changes

* chore: Append the default commit template

The default message contains information about the current branch, and
which files have been changed
  • Loading branch information
KaelWD authored and johnleider committed Oct 10, 2017
1 parent 3279d5d commit 8acb3fa
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/.git_commit_msg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->| Hard limit to 72 -->|


# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|

# Provide links to any relevant issues, articles, commits, or other
# pull requests
# Example: See #23, fixes #58

# --- COMMIT END ---
# <type> can be
# feat (new feature)
# fix (bug fix)
# refactor (refactoring production code)
# style (formatting, missing semi colons, etc; no code change)
# test (adding or refactoring tests; no production code change)
# chore (updating npm scripts etc; no production code change)
# --------------------
# Remember to
# Capitalize the subject line
# Use the imperative mood in the subject line
# Do not end the subject line with a period
# Separate subject from body with a blank line (comments don't count)
# Use the body to explain what and why vs. how
# Can use multiple lines with "-" for bullet points in body
#
# If you can't summarize your changes in a single line, they should
# probably be split into multiple commits
# --------------------
# For more information about this template, check out
# https://gist.github.com/adeekshith/cd4c95a064977cdc6c50
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ dev/*.js
dev/*css
!dev/index.js
!dev/router.js
!dev/prepare-commit-message.js
/es5
/dist
14 changes: 14 additions & 0 deletions dev/prepare-commit-message.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const fs = require('fs')

const [
messageFile,
commitType,
commitHash
] = process.env.GIT_PARAMS.split(' ')

if (commitType == null) {
const currentMessage = fs.readFileSync(messageFile)
const newMessage = fs.readFileSync('.github/.git_commit_msg.txt')
fs.writeFileSync(messageFile, newMessage)
fs.appendFileSync(messageFile, currentMessage)
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"version": "npm run build",
"test": "cross-env NODE_ENV=test jest",
"lint": "eslint --ext .js,.vue src",
"preparecommitmsg": "node dev/prepare-commit-message.js",
"precommit": "yarn run lint && yarn test",
"prepush": "yarn run lint && yarn test"
},
Expand Down

0 comments on commit 8acb3fa

Please sign in to comment.