{"id":13343249,"url":"https://github.com/idomoz/silent-committer","last_synced_at":"2025-03-12T04:32:54.484Z","repository":{"id":47718144,"uuid":"396760311","full_name":"idomoz/silent-committer","owner":"idomoz","description":"Commits changes as original authors","archived":false,"fork":false,"pushed_at":"2023-02-15T15:29:21.000Z","size":21,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-02-23T00:23:01.637Z","etag":null,"topics":["authors","commit","git","git-commit","python-script","xonsh"],"latest_commit_sha":null,"homepage":"","language":"Xonsh","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/idomoz.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":"2021-08-16T11:19:46.000Z","updated_at":"2024-07-29T23:37:02.305Z","dependencies_parsed_at":"2024-07-29T23:54:02.632Z","dependency_job_id":null,"html_url":"https://github.com/idomoz/silent-committer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idomoz%2Fsilent-committer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idomoz%2Fsilent-committer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idomoz%2Fsilent-committer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/idomoz%2Fsilent-committer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/idomoz","download_url":"https://codeload.github.com/idomoz/silent-committer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243158974,"owners_count":20245668,"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":["authors","commit","git","git-commit","python-script","xonsh"],"created_at":"2024-07-29T19:30:42.957Z","updated_at":"2025-03-12T04:32:54.191Z","avatar_url":"https://github.com/idomoz.png","language":"Xonsh","funding_links":[],"categories":[],"sub_categories":[],"readme":"![versions](assets/pybadges.svg)\n\n# silent-committer\n\nCommits changes as original authors\n\n## What is this for?\nDoing a styling refactor? Applying a lint rule? Upgrading all calls of a function to a new signature?  \nThese tasks usually don't change the logic behind the code, and so we might want git blame to show the original author of the line before we made our cosmetic change.   \nGit has an option to specify a different author for the entire commit (--author) but that will use a single author for our entire changes.\n\nThat's where *silent-committer* comes in -  \nIt analyses your uncommitted changes to find all the original authors, and then commits your changes in separate commits, each with a different author and only the code you changed of that author.\n\n## Installation\n\n```sh\npip install silent_committer\n```\n\n## Usage\n\n```sh\ncd \u003cproject_root\u003e\nsilently-commit \"\u003ccommit_msg\u003e\"\n```\n\nExample output of `git log` after running `silently-commit \"Update usage of foo.bar()\"`:\n```git\ncommit 440b2aac9c9416c949c4727cd1e1ebba521e0b91 (HEAD -\u003e master)\nAuthor: John Doe \u003cjohn.doe@example.com\u003e\nDate:   Tue Aug 9 12:51:43 2022 +0200\n\n    Update usage of foo.bar(); For user: John Doe \u003cjohn.doe@example.com\u003e\n\ncommit 3e2ed2c0fda7c0419b13ebd80b9c68f28a007f1c\nAuthor: Philip Jackson \u003cpjackson@example.com\u003e\nDate:   Tue Aug 9 12:51:43 2022 +0200\n\n    Update usage of foo.bar(); For user: Philip Jackson \u003cpjackson@example.com\u003e\n\ncommit 74ba0e526707f8aa0eb8c1fdca2938c1b2d44b9f\nAuthor: Kate Cole \u003ckate299@example.com\u003e\nDate:   Tue Aug 9 12:51:42 2022 +0200\n\n    Update usage of foo.bar(); For user: Kate Cole \u003ckate299@example.com\u003e\n\ncommit 79d9fe1ee9176db71ccd3c96b3faa235ab055874\nAuthor: William Calvert \u003cwilliamcal@example.com\u003e\nDate:   Tue Aug 9 12:51:42 2022 +0200\n\n    Update usage of foo.bar(); For user: William Calvert \u003cwilliamcal@example.com\u003e\n```\n\n## How does this work?\n\nSilent committer does the following steps:\n\n1. Unstages all changes.\n2. Runs `git add -p` and splits all hunks that are splittable.\n3. Parses the output of `git add -p` to get all hunks.\n4. Stashes all changes (to be able to run `git blame`).\n5. Finds the authors of all the changed lines using `git blame -w`.\n6. Calculates the author of each hunk (if there is only one author for the changed lines in the hunk it uses that author,\notherwise it uses one of the authors of the changed lines that contibuted most to that hunk).\n7. For each author - it stages all of its hunks and creates a commit using the `\u003ccommit_msg\u003e` passed as arg and appends the author details.\nFor example if `\u003ccommit_msg\u003e` is `pep8 formatting` then it will create a commit with the message `pep8 formatting; For user: John Doe \u003cjohn.doe@example.com\u003e`\nfor each author with the author being the original author while the committer still remains you.\n8. All line additions (new and not modified lines) will be commited with you as the author.\n\n*** **New files are not supported as this tool relies on unstaging all files, causing new files to become untracked and then it can’t know which of the untracked files you intend to commit, so please first commit all new files separately.**\n\n## Disclaimer\n\nIn order to prevent code loss, it's best to first commit your changes and the run `git reset --soft HEAD^` so that you could return to your changes\nusing `git reflog` or alternitively stash your changes and run `git stash apply` to keep your changes in the stash if something goes wrong.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidomoz%2Fsilent-committer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fidomoz%2Fsilent-committer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fidomoz%2Fsilent-committer/lists"}