{"id":23157904,"url":"https://github.com/piyook/validate-branch-name","last_synced_at":"2026-05-10T19:09:25.488Z","repository":{"id":267631709,"uuid":"901249735","full_name":"piyook/validate-branch-name","owner":"piyook","description":"A simple bash script to validate local git branch name","archived":false,"fork":false,"pushed_at":"2024-12-11T14:06:07.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T03:29:32.809Z","etag":null,"topics":["bash-script","git","husky"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/piyook.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-10T10:09:31.000Z","updated_at":"2024-12-11T14:06:12.000Z","dependencies_parsed_at":"2024-12-11T14:22:53.257Z","dependency_job_id":"7d07c6af-855b-4b1c-8632-609e29f01b08","html_url":"https://github.com/piyook/validate-branch-name","commit_stats":null,"previous_names":["piyook/validate-branch-name"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyook%2Fvalidate-branch-name","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyook%2Fvalidate-branch-name/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyook%2Fvalidate-branch-name/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/piyook%2Fvalidate-branch-name/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/piyook","download_url":"https://codeload.github.com/piyook/validate-branch-name/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247226500,"owners_count":20904521,"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":["bash-script","git","husky"],"created_at":"2024-12-17T22:16:16.229Z","updated_at":"2026-05-10T19:09:25.460Z","avatar_url":"https://github.com/piyook.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Validate Git Branch Name\n\nA simple bash script to validate local git branch name without the need to install packages or dependencies.\n\n## Using\n\nCopy validate-branch-name.sh bash script to project root and add the following to package.json\n\n```bash\n\"validate-branch-name\": \"bash validate-branch-name.sh\"\n```\n\nThe script can be run from the command line with\n\n```\nnpm run validate-branch-name\n```\n\nCombine with Husky to check branch names before committing or pushing to GitHub.\n\nFor example in '.husky/pre-push':\n\n```bash\nnpm run validate-branch-name\nnpm audit --omit=dev\n```\n\n**Alternatively**, the validation script can be copied and pasted directly into the relevant husky hook script and executed directly.\n\nThe default acceptable branch pattern is:\n\n```bash\nfeat|fix|hotfix|release|chore/your-branch-name\n```\n\nSo **'feat/test-branch'** will pass validation but **'test-branch'** will fail.\n\nNote that **'main'** and **'dev'** branch names bypass checks as they are 'standard' branch names.\n\n## Customisation\n\nThe RegEx can be modified to fit any branch naming practice that is being used.\n\nReplace default REGEX value with custom regex (some examples below).\n\nReplace default STANDARD_BRANCHES value with names of standard branches names that avoid regex checks (E.g 'main|working')\n\n```\nREGEX='^(feat|fix|hotfix|release|chore)/.'\nSTANDARD_BRANCHES='main|dev'\n```\n\nExamples:\n\n- branch name has to start with 'feature/', 'patch/', 'hotfix/' or 'release/' E.g 'hotfix/urgent'\n\n```\nREGEX='^(feat|patch|hotfix|release)/.+'\n```\n\n- branch name needs to be in the format 'feat/JIRA-1234'\n\n```\nREGEX='(feat|release|hotfix)/(JIRA-\\d+)'\n```\n\n- branch name needs to be in the format 'feature/branch-name' OR include JIRA's code like 'feat/JIRA-1234/branch-name'\n\n```\nREGEX='(feat|release|hotfix)/(JIRA-\\d+/)?[a-z-]+'\n```\n\n## Error Message\n\nChange or update the error message if custom regex is used. E.g\n\n```\nERROR_MESSAGE=\"branch name needs to be in the format 'feat/JIRA-1234'\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiyook%2Fvalidate-branch-name","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiyook%2Fvalidate-branch-name","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiyook%2Fvalidate-branch-name/lists"}