# commit-time

> Fix the time of your commits

Latest version **1.2.10** (published 2021-02-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install commit-time
pnpm add commit-time
yarn add commit-time
bun add commit-time
```

Provides the commands `commit-time`, `commit-time-hook`, `commit-time-history`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.10 |
| Published | 2021-02-18 |
| First published | 2018-06-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 21.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Commit Time |
| Maintainers | committime |
| Keywords | git, commit |

## Links

- npm: https://www.npmjs.com/package/commit-time
- npm.io page: https://npm.io/package/commit-time

## Dependencies (1)

- [debug](https://npm.io/package/debug.md) ^3.1.0

## Recent versions

- 1.2.10 (latest) — 2021-02-18
- 1.2.9 — 2018-09-17
- 1.2.8 — 2018-07-11
- 1.2.7 — 2018-07-11
- 1.2.6 — 2018-07-05
- 1.2.5 — 2018-06-25
- 1.2.4 — 2018-06-25
- 1.2.3 — 2018-06-25
- 1.2.2 — 2018-06-25
- 1.2.0 — 2018-06-25
- 1.1.1 — 2018-06-25
- 1.1.0 — 2018-06-22
- 1.0.0 — 2018-06-21

## README

# Commit time

## Configuration

Create a `~/.commit-time.json` file:

```json
{
    "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 Sunday
  - `weekdays`: From Monday to Friday
  - `*`: All days

## Installation

This will not work with `npx`. You have to install it globally.

```bash
npm i -g commit-time
```

Then you can create a configuration file with

```bash
commit-time config
```

## Usage

Go to the repo you want to hook and execute `commit-time`

```bash
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.

## 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

---
_Source: https://npm.io/package/commit-time · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
