Add Git commit template

This configures Git to use a standard commit template, in order to make
it easier to write better commit messages.

This commit adds a default template, and configures Git to use it as the
default. It also modifies the install script to install the default
template at ~/.git-commit-template. Finally, this adds an extra check to
reapply the committed Git configuration to the global Git config.
master
nirenjan 2018-09-05 15:01:26 -07:00
parent d2f9c5cdc7
commit 65fb291da3
3 changed files with 24 additions and 1 deletions

12
gitcommit 100644
View File

@ -0,0 +1,12 @@
# If applied, this commit will...
# Why is this change needed?
Prior to this change,
# How does it address the issue?
This change
# Provide links to any relevant tickets, articles or other resources
# Template sourced from
# https://codeinthehole.com/tips/a-useful-template-for-commit-messages/

View File

@ -37,6 +37,8 @@
co = checkout
ci = commit
st = status --short --branch
[commit]
template = ~/.git-commit-template
[url "git://github.com/"]
insteadOf = gh:
[url "git@github.com:"]

11
install
View File

@ -132,6 +132,12 @@ echo Installing dotfiles from $PRINT_PATH
#######################################################################
# Install git configuration
#######################################################################
if [[ ! -e ~/.git-commit-template ]]
then
echo "Installing Git commit template"
cp -v gitcommit ~/.git-commit-template
fi
if [[ ! -e ~/.gitconfig ]]
then
echo "Installing gitconfig"
@ -142,6 +148,9 @@ then
read GIT_EMAIL
git config --global user.name "$GIT_USER"
git config --global user.email "$GIT_EMAIL"
else
echo "Applying gitconfig"
./scripts/applygitconfig gitconfig
fi
# Install git prompt functions
@ -177,7 +186,7 @@ if [[ -d .git ]]
then
git pull
else
git clone git@github.com:nirenjan/vimfiles.git .
git clone my:vimfiles.git .
fi
git submodule init