From ea5d1cc10afdee6f0b1d37b0336cbd5895651b8c Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Thu, 17 Nov 2022 17:06:31 +0000 Subject: [PATCH] Update dotfiles/.gitconfig, dotfiles/.local/git-templates/hooks/post-commit --- dotfiles/.gitconfig | 2 ++ dotfiles/.local/git-templates/hooks/post-commit | 9 +++++++++ 2 files changed, 11 insertions(+) create mode 100644 dotfiles/.local/git-templates/hooks/post-commit diff --git a/dotfiles/.gitconfig b/dotfiles/.gitconfig index eef52e3d..984bae05 100644 --- a/dotfiles/.gitconfig +++ b/dotfiles/.gitconfig @@ -52,6 +52,8 @@ prompt = false [credential] helper = cache --timeout=3600 +[init] + templatedir = /Users/bzalewski/.local/git-templates [interactive] diffFilter = delta --color-only --features=interactive [merge] diff --git a/dotfiles/.local/git-templates/hooks/post-commit b/dotfiles/.local/git-templates/hooks/post-commit new file mode 100644 index 00000000..10bf082f --- /dev/null +++ b/dotfiles/.local/git-templates/hooks/post-commit @@ -0,0 +1,9 @@ +#!/bin/sh +### git-stats hook (begin) ### +# Copy last commit hash to clipboard on commit +commit_hash=$(git rev-parse HEAD) +repo_url=$(git config --get remote.origin.url) +commit_date=$(git log -1 --format=%cd) +commit_data="\"{ \"date\": \"$commit_date\", \"url\": \"$repo_url\", \"hash\": \"$commit_hash\" }\"" +git-stats --record "${commit_data}" +### git-stats hook (end) ###