{"id":16582069,"url":"https://github.com/robinst/git-merge-repos","last_synced_at":"2025-03-16T21:30:22.418Z","repository":{"id":12101723,"uuid":"14690548","full_name":"robinst/git-merge-repos","owner":"robinst","description":"Program for merging multiple Git repositories into one, preserving previous history, tags and branches","archived":false,"fork":false,"pushed_at":"2023-06-16T11:04:41.000Z","size":107,"stargazers_count":137,"open_issues_count":1,"forks_count":29,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-15T21:43:15.257Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robinst.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":"2013-11-25T16:12:23.000Z","updated_at":"2025-03-04T12:49:05.000Z","dependencies_parsed_at":"2024-10-11T22:31:21.876Z","dependency_job_id":"672ef69a-637c-4788-815c-62521aa1178d","html_url":"https://github.com/robinst/git-merge-repos","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/robinst%2Fgit-merge-repos","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinst%2Fgit-merge-repos/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinst%2Fgit-merge-repos/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinst%2Fgit-merge-repos/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robinst","download_url":"https://codeload.github.com/robinst/git-merge-repos/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830922,"owners_count":20354850,"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":[],"created_at":"2024-10-11T22:31:17.468Z","updated_at":"2025-03-16T21:30:22.077Z","avatar_url":"https://github.com/robinst.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"git-merge-repos\n===============\n\nProgram for merging multiple Git repositories into one, preserving previous\nhistory, tags and branches.\n\nThis is useful when you had multiple repositories for one project where you had\nmore or less the same set of branches and tags.\n\nHow it works. For each branch/tag name:\n\n1. All the commits of the repositories that have this branch/tag are collected.\n2. The commits are merged with 1 merge commit (with N parents).\n3. The branch/tag is recreated on this merge commit. In case of an annotated\n   tag, the tag message and tagger information is preserved (this does not work\n   for signing information).\n\nUsage\n-----\n\nWhen merging multiple repositories, you can choose between the following two\noptions:\n\n1. Preserve old commit IDs\n\n   The old history is preserved as-is. Normally, the directory structure of the\n   repositories needs to be moved into a subdirectory (one per repository).\n   This will be done in the merge commit.\n\n2. Preserve history for paths\n\n   The old history is first rewritten so that all content is within a\n   subdirectory. The merge commit does not change the directory structure.\n\nThe second option has the advantage that you will still be able to see the\nhistory of a path beyond the merge. With the first option, rename detection may\nnot be able to cope with the rename in the merge commit.\n\n### Preserve Old Commit IDs\n\nSay you have a repository at `git@example.org:foo.git` and one at\n`git@example.org:bar.git`. They both have some common tags and branches.\n\nTo merge them, run the program like this:\n\n    ./run.sh git@example.org:foo.git:foodir git@example.org:bar.git:bardir\n\nThis will create a merged repository as a subdirectory of the current\ndirectory.\n\nEach tag and branch will be on a new merge commit that merges the commits for\nthese tags/branches from foo and bar. The merge commits also change the tree\nstructure so that the contents of foo are in `foodir` and the contents of bar\nin `bardir`.\n\n### Preserve History for Paths\n\nFirst, install [git-filter-repo][git-filter-repo].\nThen, with the same example as above, do the following for each repository beforehand\n(replace `newsubdir` with the name you want):\n\n    git clone --mirror git@example.org:repo.git\n\n    cd repo\n\n    git filter-repo --to-subdirectory-filter newsubdir\n\nThen, run the program like this:\n\n    ./run.sh /absolute/path/to/foo:. /absolute/path/to/bar:.\n\nThis time, we don't want the merge commit to change the directory structure, as\nwe already did that using `git filter-repo`.\n\nDependencies\n------------\n\nYou need to have at least Java 11 installed. Note that it's also tested against newer versions such as 17.\n[Maven][maven], [JGit][jgit] and other dependencies will be automatically downloaded when running the program.\n\nOther Solutions\n---------------\n\n* When you have a simple, linear history, try out [git-stitch-repo][git-stitch-repo]\n* See the question [Combining multiple git repositories on Stack Overflow][stackoverflow]\n\nLicense\n-------\n\nCopyright © 2013, 2014 Robin Stocker\n\nLicensed under the Apache License, see LICENSE file for details.\n\n[git-filter-repo]: https://github.com/newren/git-filter-repo\n[maven]: https://maven.apache.org/\n[jgit]: https://www.eclipse.org/jgit/\n[git-stitch-repo]: https://metacpan.org/release/BOOK/Git-FastExport-0.105/view/script/git-stitch-repo\n[stackoverflow]: https://stackoverflow.com/questions/277029/combining-multiple-git-repositories\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinst%2Fgit-merge-repos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobinst%2Fgit-merge-repos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinst%2Fgit-merge-repos/lists"}