1.2.10 • Published 3 years ago
commit-time v1.2.10
Commit time
Configuration
Create a ~/.commit-time.json
file:
{
"minGap": 5,
"maxGap": 30,
"avoid": [{
"day": "weekdays",
"from": "8:00",
"to": "18:00"
}, {
"day": "monday",
"from": "14:00",
"to": "23:59"
}, {
"day": "*",
"from": "0:00",
"to": "8:00"
}]
}
- minGap
(number)
: Minimum amount of minutes between commits. Default 5. - maxGap
(number)
: Maximum amount of minutes between commits. Default 30. - from, to
(string)
: Time in HH:MM format - days
(string)
: The days this rule applies. Valid values are:monday
tuesday
wednesday
thursday
friday
saturday
sunday
weekends
: Saturday and Sundayweekdays
: From Monday to Friday*
: All days
Installation
This will not work with npx
. You have to install it globally.
npm i -g commit-time
Then you can create a configuration file with
commit-time config
Usage
Go to the repo you want to hook and execute commit-time
cd my-awesome-git-repo
commit-time
You can set DEBUG=commit-time:*
for extra information.
Commands
- install: Set the git hook in current repo.
- uninstall: Remove the git hook from current repo.
- config: Open editor with config file.
- edit-hook: Edit the hook file manually.
- hook: Execute the hook manually. Useful to test it.
- history: Rewrite branch history with fixed dates.
- It will create
${YOUR_BRANCH}-commit-time
branch with the new history. - WARN: Merge commits might cause issues. A diff will be executed at the end to confirm the code hasn't changed.
- It will create
Profit
When you try to commit in invalid time it will change it to a valid time after the last commit
NOTE: That may even, if required, be in the future