An open API service indexing awesome lists of open source software.

https://github.com/techpulsetoday/append-actual-date-time-to-git-commit-message

Append actual date and time to git commit message
https://github.com/techpulsetoday/append-actual-date-time-to-git-commit-message

git gitcommit gitconfig

Last synced: 10 months ago
JSON representation

Append actual date and time to git commit message

Awesome Lists containing this project

README

          

# commit-msg
Append actual date and time to git commit message

# Table of Contents
1. [Enable git templates](#enable-git-templates)
2. [Create a directory to hold the global hooks](#create-a-directory-to-hold-the-global-hooks)
3. [Write your hooks in ```~/.git-templates/hooks.```](#write-your-hooks-in-git-templateshooks)
4. [Make sure the hook is executable](#make-sure-the-hook-is-executable)
5. [Re-initialize git in each existing repo](#re-initialize-git-in-each-existing-repo-youd-like-to-use-this-in)

## Enable git templates:
```shell
git config --global init.templatedir "~/.git-templates"
```
This tells git to copy everything in ```~/.git-templates``` to your per-project .git/ directory when you run git init

## Create a directory to hold the global hooks:
```shell
mkdir -p ~/.git-templates/hooks
```

## Write your hooks in ```~/.git-templates/hooks```:
For example, here's a commit-msg hook (located in ~/.git-templates/hooks/commit-msg):
```shell
wget -N --no-check-certificate --content-disposition https://github.com/techpulsetoday/append-actual-date-time-to-git-commit-message/raw/master/commit-msg -P ~/.git-templates/hooks/
```

## Make sure the hook is executable:
```shell
chmod a+x ~/.git-templates/hooks/commit-msg
```

## Re-initialize git in each existing repo you'd like to use this in:
```shell
git init
```
NOTE if you already have a hook defined in your local git repo, this will not overwrite it.