git-good-commit icon indicating copy to clipboard operation
git-good-commit copied to clipboard

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

Open ssbarnea opened this issue 8 years ago • 3 comments

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

ssbarnea avatar Jan 22 '17 14:01 ssbarnea

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

tommarshall avatar Jan 24 '17 13:01 tommarshall

@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.

ssbarnea avatar Jan 24 '17 13:01 ssbarnea

@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.

tommarshall avatar Jan 24 '17 14:01 tommarshall