{"id":17093394,"url":"https://github.com/adamdehaven/change-git-author","last_synced_at":"2025-04-12T22:44:27.280Z","repository":{"id":39917766,"uuid":"146800792","full_name":"adamdehaven/change-git-author","owner":"adamdehaven","description":"Update the commit history of your git repository to resolve incorrect author information.","archived":false,"fork":false,"pushed_at":"2022-12-30T20:33:47.000Z","size":34,"stargazers_count":115,"open_issues_count":0,"forks_count":19,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-26T16:55:03.506Z","etag":null,"topics":["author","commits","git","script"],"latest_commit_sha":null,"homepage":"https://www.adamdehaven.com/blog/update-commit-history-author-information-for-git-repository/","language":"Shell","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/adamdehaven.png","metadata":{"files":{"readme":"README.md","changelog":"changeauthor.sh","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-08-30T20:05:02.000Z","updated_at":"2025-03-10T07:13:39.000Z","dependencies_parsed_at":"2023-01-31T16:00:59.080Z","dependency_job_id":null,"html_url":"https://github.com/adamdehaven/change-git-author","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamdehaven%2Fchange-git-author","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamdehaven%2Fchange-git-author/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamdehaven%2Fchange-git-author/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamdehaven%2Fchange-git-author/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adamdehaven","download_url":"https://codeload.github.com/adamdehaven/change-git-author/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248643048,"owners_count":21138353,"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":["author","commits","git","script"],"created_at":"2024-10-14T14:06:43.799Z","updated_at":"2025-04-12T22:44:27.249Z","avatar_url":"https://github.com/adamdehaven.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Change Git Author\r\n\r\nThis action is destructive to your repository's history. If you're collaborating on a repository with others, it's considered bad practice to rewrite published history.\r\n\r\n**You should only do this in an emergency.**\r\n\r\nRunning this script rewrites history for all repository collaborators. After completing these steps, any person with forks or clones must fetch the rewritten history and rebase any local changes into the rewritten history.\r\n\r\n## Usage\r\n\r\n1. [Download the script](https://github.com/adamdehaven/change-git-author) from GitHub and save it to an easily-accessible directory on your computer.\r\n2. Change the permissions of the script file to allow it to execute:\r\n\r\n    ``` sh\r\n    chmod +x /path/to/changeauthor.sh\r\n    ```\r\n\r\n3. Navigate into the repository with the incorrect commit history\r\n\r\n    ``` sh\r\n    cd path/to/repo\r\n    ```\r\n\r\n    Alternatively, you can run from anywhere by passing the `--git-dir` and `--work-tree` flags.\r\n\r\n4. Run the script (with or without flags)\r\n\r\n    ``` sh\r\n    ./changeauthor.sh [OPTIONS]...\r\n    ```\r\n\r\n    If you did not change the permissions to allow execution, you can also call the script with either of the following:\r\n\r\n    ``` sh\r\n    bash ./changeauthor.sh [OPTIONS]...\r\n\r\n    sh ./changeauthor.sh [OPTIONS]...\r\n    ```\r\n\r\n    If you run the script with no [option flags](#options), you will be prompted for the needed values via interactive prompts. The script will then proceed to update your local repository and push the changes to the specified remote.\r\n\r\n----\r\n\r\nIf you would like to suppress the git-filter-branch warning, simply add the following line the `~/.bashrc` file on your computer:\r\n\r\n``` sh\r\nexport FILTER_BRANCH_SQUELCH_WARNING=1\r\n```\r\n\r\nIf you prefer to set up the script as a function you can call from anywhere, add the following function to your `~/.bashrc` file:\r\n\r\n``` sh\r\nfunction changegitauthor() {\r\n  # Update the path to point to the absolute path of the script on your computer\r\n  bash /c/absolute/path/to/change-git-author/changeauthor.sh \"$@\"\r\n}\r\n```\r\n\r\n## Options\r\n\r\nYou may pass options (as flags) directly to the script, or pass nothing to run the script in interactive mode.\r\n\r\n### old-email\r\n\r\n- Usage: `-o`, `--old-email`\r\n- Example: `emmett.brown@example.com`\r\n\r\nThe old/incorrect email address of the author you would like to replace in the commit history.\r\n\r\n### new-email\r\n\r\n- Usage: `-e`, `--new-email`\r\n- Example: `marty.mcfly@example.com`\r\n\r\nThe new/corrected email address to replace in commits matching the [old-email](#old-email) address.\r\n\r\n### new-name\r\n\r\n- Usage: `-n`, `--new-name`\r\n- Example: `Marty McFly`\r\n\r\nThe new/corrected name for the new commit author info. (Be sure to enclose name in quotes)\r\n\r\n### remote\r\n\r\n- Usage: `-r`, `--remote`\r\n- Default: `origin`\r\n- Example: `github`\r\n\r\nThe name of the repository remote you would like to alter.\r\n\r\n### force\r\n\r\n- Usage: `-f`, `--force`\r\n\r\nAllows the script to run successfully in a non-interactive shell (assuming all required flags are set), bypassing the confirmation prompt.\r\n\r\nIf you do not pass a value to the `--remote` flag when using `--force`, the default remote (`origin`) will be used.\r\n\r\n\u003e **WARNING**\r\n\u003e\r\n\u003e By passing the `--force` flag (along with all other required flags), **there is no turning back**. \u003e Once you start the script, the process will start and can severely damage your repository if used incorrectly.\r\n\r\n### git-dir\r\n\r\n- Usage: `-d`, `--git-dir`\r\n\r\nSet the path to the repository (\".git\" directory) if it differs from the current directory. It can be an absolute path or relative path to current working directory.\r\n\r\nThis option should be used in conjunction with the `--work-tree` flag.\r\n\r\n### work-tree\r\n\r\n- Usage: `-w`, `--work-tree`\r\n\r\nSet the path to the working tree. It can be an absolute path or a path relative to the current working directory.\r\n\r\n### help\r\n\r\n- Usage: `-h`, `-?`, `--help`\r\n\r\nShow the help content.\r\n\r\n### version\r\n\r\n- Usage: `-v`, `-V`, `--version`\r\n\r\nShow version information.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamdehaven%2Fchange-git-author","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamdehaven%2Fchange-git-author","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamdehaven%2Fchange-git-author/lists"}