{"id":18022035,"url":"https://github.com/danielschaffer/git-hook-email-selector","last_synced_at":"2026-05-16T18:05:54.334Z","repository":{"id":57143987,"uuid":"121896301","full_name":"DanielSchaffer/git-hook-email-selector","owner":"DanielSchaffer","description":"A pre-commit git hook that automatically prompts you to configure the local repository with an email from a preconfigured list.","archived":false,"fork":false,"pushed_at":"2018-02-20T03:28:37.000Z","size":17,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-30T08:26:30.555Z","etag":null,"topics":["authoring","email","git","git-hooks","hooks","pre-commit"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DanielSchaffer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-17T22:02:20.000Z","updated_at":"2022-07-04T11:34:53.000Z","dependencies_parsed_at":"2022-09-06T00:11:24.213Z","dependency_job_id":null,"html_url":"https://github.com/DanielSchaffer/git-hook-email-selector","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielSchaffer%2Fgit-hook-email-selector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielSchaffer%2Fgit-hook-email-selector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielSchaffer%2Fgit-hook-email-selector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielSchaffer%2Fgit-hook-email-selector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanielSchaffer","download_url":"https://codeload.github.com/DanielSchaffer/git-hook-email-selector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226198,"owners_count":20904464,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authoring","email","git","git-hooks","hooks","pre-commit"],"created_at":"2024-10-30T06:11:50.884Z","updated_at":"2026-05-16T18:05:54.293Z","avatar_url":"https://github.com/DanielSchaffer.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# git-hook-email-selector\n\nThis is a pre-commit hook aimed at developers who want to be able to\neasily manage making commits with multiple emails. For example, you can\nuse your work email to author commits for your job, and your personal\nemail to author commits for your hobby projects.\n\nDuring the pre-commit, this hook well check `git config` to see whether\nthere is an email configured for the current repository. It does this\nusing the command:\n\n```\ngit config --local --get user.email\n```\n\nIf there is no local user email configured, it will prompt you to choose\nfrom a list of configured emails, and attempt to pick the best default\nby matching a pattern you define, using git config's global email as the\nfallback default if no entries are match by pattern.\n\nAdditionally, you have to option to configure a separate name. If no\nname is configured, git will use whatever is set at the global or system\nlevel.\n\n## Installation\n\nThis hook requires the [NodeJS](https://nodejs.org/) runtime to be\ninstalled.\n\nIt is recommended that this hook is installed using the `core.hooksPath`\nglobal configuration key. This will allow the hook to run for all of\nyour existing repositories, as well as any repositories you clone in the\nfuture. To install this hook as a core hook, run the following commands:\n\n```\nnpm i -g git-hook-email-selector\ninstall-git-hook-email-selector\n```\n\nThe `install-git-hook-email-selector` script will attempt to install the\nhook to `~/.git-hooks`. If you already have `core.hooksPath` defined, it\nwill use the existing path and attempt to append the\n`git-hook-email-selector` command to any existing `pre-commit` hook.\n\n## Configuration\n\nThe hook is configured entirely using `git config`.\n\nTo add an entry, add the following config keys:\n\n```\ngit config --global --add email-selector.DESCRIPTION.email YOUR_EMAIL\ngit config --global --add email-selector.DESCRIPTION.pattern MATCH_PATTERN\n# optional\ngit config --global --add email-selector.DESCRIPTION.name YOUR NAME\n```\n\nFor example:\n```\ngit config --global --add email-selector.work.email joe@schmoeco.com\ngit config --global --add email-selector.work.pattern github.com:schmoeco\n# optional\ngit config --global --add email-selector.work.name Joe Schmoe\n```\n\nIf you'd prefer to edit your `.gitconfig` file directly, it the section\nshould look like this:\n\n```\n[email-selector \"work\"]\n    email = joe@schmoeco.com\n    pattern = github.com:schmoeco\n    name = Joe Schmoe\n```\n\nYou can add as many entries as you need. Patterns are optional if you\nneed to manually choose an email.\n\n```\n[email-selector \"work\"]\n    email = joe@schmoeco.com\n    pattern = github.com:schmoeco\n\n[email-selector \"hobby\"]\n    email = joe@home.com\n    pattern = github.com:jschmoe\n\n[email-selector \"oss-projects\"]\n    email = joe@joepensource.com\n    name = Joe Incognischmoe\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielschaffer%2Fgit-hook-email-selector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielschaffer%2Fgit-hook-email-selector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielschaffer%2Fgit-hook-email-selector/lists"}