tommarshall / git-good-commit

Git hook to help you write good commit messages, with no external dependencies.
MIT License
193 stars 33 forks source link

Use standard ~/.config/git location instead of ~/.git-templates one #14

Open ssbarnea opened 7 years ago

ssbarnea commented 7 years ago

It think it would be much better to use ~/.config/git location instead of creating a new folder inside the user home directory, even if it is a hidden one.

That location is already prefered by git ignored, see https://git-scm.com/docs/gitignore

tommarshall commented 7 years ago

Hi @ssbarnea,

Thanks for raising this. I wasn't aware of the ~/.config/git directory.

Am I right in thinking you're proposing a changing the global installation instructions to the following?

mkdir -p ~/.config/git/hooks
git config --global init.templatedir '~/.config/git/hooks'
curl https://cdn.rawgit.com/tommarshall/git-good-commit/v0.6.1/hook.sh > ~/.config/git/hooks/commit-msg && chmod +x ~/.config/git/hooks/commit-msg

Tom

ssbarnea commented 7 years ago

@tommarshall Before making any changes we should first do some testing. I am not sure if this works across all platforms and versions of git. I will do some testing and be back with my results.

tommarshall commented 7 years ago

@ssbarnea sounds good.

Thinking about it, it would need to be ~/.config/git/templates/hooks rather than ~/.config/git/hooks.

Neither the githooks docs nor the git-init templatedir docs mention the ~/.config/git directory, so it doesn't appear to be an official Git standard for init.templatedir, but I do agree that it would be nicer to house the template dir within ~/.config/git, providing it's safe to do so.