{"id":26756882,"url":"https://github.com/picojr/pre-commit-mail-selection","last_synced_at":"2026-05-14T20:32:50.716Z","repository":{"id":284805137,"uuid":"955589063","full_name":"PicoJr/pre-commit-mail-selection","owner":"PicoJr","description":"pre commit email selection git hook","archived":false,"fork":false,"pushed_at":"2025-03-27T18:32:58.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T19:37:24.421Z","etag":null,"topics":["git","hook","pre-commit-hook","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PicoJr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-26T22:01:31.000Z","updated_at":"2025-03-27T18:34:52.000Z","dependencies_parsed_at":"2025-03-27T19:49:49.766Z","dependency_job_id":null,"html_url":"https://github.com/PicoJr/pre-commit-mail-selection","commit_stats":null,"previous_names":["picojr/pre-commit-mail-selection"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PicoJr%2Fpre-commit-mail-selection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PicoJr%2Fpre-commit-mail-selection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PicoJr%2Fpre-commit-mail-selection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PicoJr%2Fpre-commit-mail-selection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PicoJr","download_url":"https://codeload.github.com/PicoJr/pre-commit-mail-selection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246049675,"owners_count":20715513,"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":["git","hook","pre-commit-hook","rust"],"created_at":"2025-03-28T15:21:40.072Z","updated_at":"2026-05-14T20:32:50.663Z","avatar_url":"https://github.com/PicoJr.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pre Commit Email Selection Git Hook\n\nIt looks like this (YMMV) if you configure this as your pre-commit hook:\n\n```\n? Please select an email for commit ›\n❯ foo@bar.com\n  baz@example.com\n```\n\nIt will ask **each time** which email you would like to configure before committing.\n\nYour selection will be written to your local `.git/config` and used for the current commit.\n\n## But why would anyone use/need this ?\n\nI admit it's really niche, just imagine you happened to share a local git repository with someone,  \nyou both work on the same files, with the same user, on an airtight (no internet) system,  \nand you wish to be able to distinguish commit authors.\n\nSounds awful ? It should. \n\nIt could also be useful if you need to contribute with several identities on a regular basis,  \nfrom the same local git repository.\n\n## How does it work ?\n\nIt lists emails from the following sources:\n\n1. local `.git/config`\n2. global git config (several possible paths)\n3. `.git-emails.toml`\n\nIt then presents a selection menu for choosing the email you wish to use for committing.\n\nYour selection will be written to your local `.git/config` and used for the current commit.\n\nSince the default selection is the email from `.git/config`, it will remember your last choice:  \nthe last configured email will be the first one in the selection list the next time it runs.\n\n## How to build it so that it runs with minimal dependencies (statically)\n\nBuild using musl\n\n```\ncargo build --target=x86_64-unknown-linux-musl\n```\n\nand then\n\n```\n❯ ldd target/x86_64-unknown-linux-musl/debug/pre-commit-mail-selection\n        statically linked\n```\n\n## How to configure it as my `pre-commit` hook ?\n\n1. compile it: `cargo build --target=x86_64-unknown-linux-musl --release`\n2. install it `cp target/x86_64-unknown-linux-musl/release/pre-commit-mail-selection .git/hooks/pre-commit`\n\n## How do I supply my own emails ?\n\ncreate `.git-emails.toml` file inside your git repository:\n\nsee [.git-emails.toml](./.git-emails.toml) for an example.\n\n## Known issue\n\nDoes not work with IDE that do not run pre-commit hooks in a terminal.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpicojr%2Fpre-commit-mail-selection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpicojr%2Fpre-commit-mail-selection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpicojr%2Fpre-commit-mail-selection/lists"}