{"id":37101391,"url":"https://github.com/artem-y/commit","last_synced_at":"2026-04-04T20:03:11.325Z","repository":{"id":235019714,"uuid":"785480454","full_name":"artem-y/commit","owner":"artem-y","description":"Simple CLI tool that includes issue number into commit message","archived":false,"fork":false,"pushed_at":"2025-03-27T19:32:43.000Z","size":85,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-14T14:39:09.073Z","etag":null,"topics":["cli","git","go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/artem-y.png","metadata":{"files":{"readme":"docs/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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-04-12T00:57:11.000Z","updated_at":"2025-03-27T19:32:42.000Z","dependencies_parsed_at":"2024-04-22T02:29:37.540Z","dependency_job_id":"39d03837-6a82-4207-8ee9-b24b04113d71","html_url":"https://github.com/artem-y/commit","commit_stats":null,"previous_names":["artem-y/commit"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/artem-y/commit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artem-y%2Fcommit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artem-y%2Fcommit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artem-y%2Fcommit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artem-y%2Fcommit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artem-y","download_url":"https://codeload.github.com/artem-y/commit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artem-y%2Fcommit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31411697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T19:29:44.979Z","status":"ssl_error","status_checked_at":"2026-04-04T19:29:11.535Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cli","git","go"],"created_at":"2026-01-14T12:19:01.582Z","updated_at":"2026-04-04T20:03:11.318Z","avatar_url":"https://github.com/artem-y.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# commit\nSimple CLI tool that finds an issue number in the branch and includes it in the commit message.\n\n## Installation\n### Install Pre-built Executable\n1. In the [Releases](https://github.com/artem-y/commit/releases) section, find and open the latest release (or any other one if you want).\n2. Download `bin.zip` archive\n3. Unarchive it and find a folder for your machine's architecture.\n4. Make sure your system allows execution of the tool. For example, on Linux/macOS, use `chmod +x \u003cpath-to-commit-executable\u003e` command to enable the \"execute\" permission. Adjust other settings if needed.\n5. Move the executable into one of the directories visible in `PATH` so that the command is visible and reachable from anywhere.\n6. If you want to use a custom path to a global `.commit.json` file for all the repositories, you can specify it with a typealias in your `.bashrc` or `.zshrc` file etc.  \n   For example:  \n   ```shell\n   alias commit=\"commit -config-path=${HOME}/.config/.commit.json\"\n   ```\n### Install With Makefile\n1. Make sure you have a compatible version of `Go` installed _(see [go.mod](https://github.com/artem-y/commit/blob/main/go.mod#L3) file)_\n2. Clone the repository\n3. In the root of the repository, run `make build` command\n4. Find the executable in `bin` directory, move it into one of the directories visible in `PATH` so that it is visible and reachable from anywhere.\n5. If you want to use a custom path to a global `.commit.json` file for all the repositories, you can specify it with a typealias in your `.bashrc` or `.zshrc` file etc.  \n   For example:  \n   ```shell\n   alias commit=\"commit -config-path=${HOME}/.config/.commit.json\"\n   ```  \n\nCheck out the [Makefile](/Makefile) for more commands.\n\n### Easy Installation With Makefile\nThere's a helper command that can simplify installation:\n```shell\nmake install\n```\n1. Make sure you have a compatible version of `Go` installed _(see [go.mod](https://github.com/artem-y/commit/blob/main/go.mod#L3) file)_\n2. Clone the repository\n3. In the root of the repository, run `make install`\n4. _(Optional)_ It will try to install to where the tool was installed previously. In case this is the first installation, it will be installed in the default Go package directory. If the tool is not visible after instllation, make sure its directory is included in `PATH`.\n\n### Install With Go Tooling\nYou can do the steps described above in the [Install With Makefile](#install-with-makefile) section, replacing Step 3 (`make build` command) with just a plain Go build command:  \n```shell\ngo build -o bin/ ./cmd/commit\n```\nOr you can skip even those steps and use `go install` command:\n```shell\ngo install -ldflags \"-s -w\" ./cmd/commit\n```\nThis will install the executable in the default Go package directory. If the tool is not visible after installation, make sure its directory is included in `PATH`.\n\nFor more information, see [Tutorial: Compile and install the application](https://go.dev/doc/tutorial/compile-install) \n## Usage\nTo commit all staged changes, use `commit` command with some commit message:\n```shell\ncommit \"Refactor core service initialization logic\"\n```\nThe result: for example, if the branch name is `312-improve-stability-of-the-core-service`, the resulting commit will have a message:\n\n\u003e #312: Refactor core service initialization logic\n### Configuration\nBy default, the tool recognizes the pattern suggested by GitHub when auto-generating branches, when issue numbers are just digits: `28-update-documentation` for the issue  `#28`.  \nBut this can be changed by providing a `.commit.json` file with different values at the root of your repository:  \n```json\n{\n    \"issueRegex\": \"ABC-[0-9]+\",\n    \"outputIssuePrefix\": \"#\",\n    \"outputIssueSuffix\": \"\",\n    \"outputStringPrefix\": \"\",\n    \"outputStringSuffix\": \": \",\n}\n```\nWhat each setting does:\n- **issueRegex**: This is how the tool determines what is the pattern to look for.\n- **outputIssuePrefix**: Added before each issue.\n- **outputIssueSuffix**: Added after each issue.\n- **outputStringPrefix**: Precedes the generated part of the commit message.\n- **outputStringSuffix**: Follows at the end of the generated part of the commit message.\n\nThe structure of the resulting commit message is as follows:  \n```\n\u003coutputStringPrefix\u003e\u003coutputIssuePrefix\u003e\u003cissueRegex\u003e\u003coutputIssueSuffix\u003e, \u003coutputIssuePrefix\u003e\u003cissueRegex\u003e\u003coutputIssueSuffix\u003e\u003coutputStringSuffix\u003e \u003ccommit message\u003e\n```\nIf the `.commit.json` file is not included, the tool will just fall back to its default settings (GitHub style issues). See the default values in [constants.go](/internal/helpers/constants.go) file.\n### Custom Config Path\nIf you don't want to include the `.commit.json` file at the root of your repository, path to the config file can be passed with a `-config-path` flag like this (linux/macOS shell example):\n```shell\ncommit -config-path=${HOME}/.config/.commit.json \"Finally fix everything\"\n```\n### Multiple Issue Numbers\nIf the branch has multiple issues in its name, the tool will include them all, comma-separated.  \nFor example, the branch named `add-tests-for-CR-127-and-CR-131-features`, the issue regex set to `[A-Z]{2}-[0-9]+`, and the \"outputIssuePrefix\" and \"outputIssueSuffix\" settings for the output set to `[` and `]:`, the generated commit message would start with the following:  \n\u003e [CR-127, CR-131]:\n## Testing\nSo far only the core parts of the logic are covered with tests, but I will be adding more in the future.  \nTo run the unit tests, use the `make test` or `go test -v ./...` commands.  \nThere also are a few end-to-end tests that will run in the CI pipeline to make sure the tool actually works as expected with a real repository. I do not advise running those often manually, since they can potentially execute destructive commands. For example, there is at least one change the tests will try to apply to the global git setup, which is the setting of the default init branch to \"main\".\n### Debug\nTo check what commit message will be generated without making the actual commit, there is a `-dry-run` flag that can be passed to the command:\n```shell\ncommit -dry-run \"Not a real commit\"\n```\n## Contributing\nOriginally I wrote this tool for myself in shell and Swift and used a lot on MacOS. This repo is an attempt to make it crossplatform and an opportunity to excercise in writing Go.  \nIf you find it useful and see that something's wrong or missing, feel free to raise issues and contribute to the project.  \nWhen doing so, please follow the ususal code of conduct and contribution guidelines from GitHub, and just common sense.\n## License\nThis repository is distributed under the MIT license (see [LICENSE](/LICENSE)).  \nMy tool uses [go-git](https://github.com/go-git/go-git) as a 3rd party dependency to work with git directly, you might want to check it out too.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartem-y%2Fcommit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartem-y%2Fcommit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartem-y%2Fcommit/lists"}