{"id":15035843,"url":"https://github.com/tiavision/GitRewrite","last_synced_at":"2025-10-04T02:31:07.517Z","repository":{"id":52831704,"uuid":"193227531","full_name":"tiavision/GitRewrite","owner":"tiavision","description":"Rewrite git history. Faster alternative to git filter-branch or bfg-repo-cleaner to perform certain rewrite tasks on a git repository.","archived":true,"fork":false,"pushed_at":"2024-04-20T14:04:38.000Z","size":143,"stargazers_count":90,"open_issues_count":4,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-03T14:19:35.651Z","etag":null,"topics":["c-sharp","csharp","csharp-code","dotnet","dotnet-core","git","git-filter"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":false,"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/tiavision.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","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":"2019-06-22T11:43:13.000Z","updated_at":"2024-05-07T13:57:12.000Z","dependencies_parsed_at":"2024-01-17T23:44:21.087Z","dependency_job_id":"34b9198f-6722-4ece-8302-9f9ca2446f49","html_url":"https://github.com/tiavision/GitRewrite","commit_stats":null,"previous_names":["heinrichti/gitrewrite","tiavision/gitrewrite"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiavision%2FGitRewrite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiavision%2FGitRewrite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiavision%2FGitRewrite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tiavision%2FGitRewrite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tiavision","download_url":"https://codeload.github.com/tiavision/GitRewrite/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235212749,"owners_count":18953661,"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":["c-sharp","csharp","csharp-code","dotnet","dotnet-core","git","git-filter"],"created_at":"2024-09-24T20:29:36.198Z","updated_at":"2025-10-04T02:31:07.215Z","avatar_url":"https://github.com/tiavision.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitRewrite\n\u003e **Note**\n\u003e This project is deprecated in favor of its [rewrite in Rust](https://github.com/heinrichti/gitrw). It will not receive new features or bug fixes.\n\nRewrite git history.\n\nFaster alternative to git filter-branch or bfg-repo-cleaner to perform certain rewrite tasks.\nIt was tested on windows and linux.\n\nWith this tool the repository can be rewritten in a few different ways, like removing deleting files and folders, \nremoving empty commits or rewriting committer and author information.\n\nDocker images are available here: https://hub.docker.com/r/lightraven/git-rewrite\n\n[![Build status](https://ci.appveyor.com/api/projects/status/gqdtitbjcd3mquta?svg=true)](https://ci.appveyor.com/project/TimHeinrich/gitrewrite)\n\n## Important notice\nThis tool will rewrite the git history and therefore change many, if not all, commit hashes.\nIt will also unsign signed commits. \nOnly use it if you fully understand the implications of this!\n\n## Usage\n### Deleting files\n```cmd\nGitRewrite C:/VCS/MyRepo -d file1,file2,file3\nGitRewrite C:/VCS/MyRepo --delete-files file1,file2,file3\nGitRewrite C:/VCS/MyRepo -d file1,file2,file3 --protect-refs\nGitRewrite C:/VCS/MyRepo --delete-files file1,file2,file3 --protect-refs\n```\nDeleting should be pretty fast, especially when specifying the whole path to the file. \nSimple wildcards for the beginning and the end of the filename are supported, like \u0026ast;.zip.\nIt also lets you specify the complete path to the file instead of only a file name.\nFor this the path has to be prefixed by a forward slash and the path seperator also is a forward slash: /path/to/file.txt\nSpecifying only files with complete path will result in much better performance as not all subtrees have to be checked.\n\nIf the goal is to delete files but keep them in all refs (branches and tags) use the --protect-refs flag. \nWith this flag GitRewrite will not touch files in a commit a ref points to. \n\n### Deleting directories\n```\nGitRewrite -D folder1,folder2,folder3\nGitRewrite --delete-directories folder1,folder2,folder3\nGitRewrite -D folder1,folder2,folder3 --protect-refs\nGitRewrite --delete-directories folder1,folder2,folder3 --protect-refs\n```\nPatterns and performance characteristics are the same as for deleting files. Can be used in conjunction with -d.\n\n### Remove empty commits\nAnother useful feature is to remove empty commits. \nFor this tool empty commits are defined as commits that have only a single parent and the same tree as their parent.\nWith git filter-branch this takes days for huge repositories, with GitRewrite it should only be a matter of seconds to minutes.\n```\nGitRewrite C:/VCS/MyRepo -e\n```\nThis should performa really fast as each commit has to be read only once and written if a parent has changed.\n\n### Rewrite trees with duplicate entries\nThe main motivation for this tool was a repository where git gc complained about trees having duplicate entries. \nGitRewrite solves this problem by rewriting the trees by removing the duplicates, then rewriting all parent trees, commit and all following commits.\n```\nGitRewrite C:/VCS/MyRepo --fix-trees\n```\n\n### List contributor names\nLists all authors and committers.\n```\nGitRewrite C:/VCS/MyRepo --contributor-names\n```\n\n### Rewrite all contributor names\n```\nGitRewrite C:/VCS/MyRepo --rewrite-contributors [contributors.txt]\n```\nRewrites authors and committers.\nThe contributors.txt is the mapping from old contributor name to new contributor name:\n  Old User \\\u003cold@gmail.com\u003e = New User \\\u003cnew@gmail.com\u003e\n\n### General \nThe different actions can only be performed one at a time, for example it is not possible to mix -e and -d.\n\n## Cleanup\nAfter a GitRewrite run files are not actually deleted from the file system. To do this you should run\n```\ngit reflog expire --expire=now --all \u0026\u0026 git gc --aggressive\n```\nInstead of git gc --aggressive you might want to use something faster like git gc --prune=now, while the result may not be as good.\n\n## Important notes\nGitRewrite was tested only on a few repository, so there is a big chance that it might fail for you.\nPlease let me know of any issues or feature requests, I will update the tool when I find the time for it. \nPull requests very welcome! Still searching for a way to make this even faster, maybe some parallelization options that I have not employed yet or faster file acces (while this should be pretty efficient already using memory mapped files)\n\n## Build instructions\nCurrently we are building with .NET 7, so the SDK should be installed.\n```\ngit clone https://github.com/TimHeinrich/GitRewrite.git\ncd GitRewrite\ndotnet publish -c Release\n```\n\n## Icon attribution\ndisconnect by Dmitry Baranovskiy from the Noun Project\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiavision%2FGitRewrite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiavision%2FGitRewrite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiavision%2FGitRewrite/lists"}