https://github.com/zikani03/git-monorepo
Make Git monorepos like a boss.
https://github.com/zikani03/git-monorepo
devtools git monorepo
Last synced: 3 months ago
JSON representation
Make Git monorepos like a boss.
- Host: GitHub
- URL: https://github.com/zikani03/git-monorepo
- Owner: zikani03
- License: mit
- Created: 2021-11-07T14:04:54.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-24T16:17:56.000Z (12 months ago)
- Last Synced: 2025-04-09T20:52:57.990Z (3 months ago)
- Topics: devtools, git, monorepo
- Language: Go
- Homepage: https://labs.zikani.me/git-monorepo/
- Size: 46.9 KB
- Stars: 11
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
git-monorepo
============> Make Git monorepos like a boss.
`git-monorepo` is a tool that allows you to combine two or more Git repositories into one repository and preserves the commit history for each repo as well as the directory structure.
## Features
- Preserves commit history for each repo
- Preserves Directory structure of each repo
- Orders Commits chronologically## Building
git-monorepo requires atleast Go 1.18 to build.
```sh
$ git clone https://github.com/zikani03/git-monorepo
$ go build -o git-monorepo ./cmd/main.go
```## Usage
> NOTE: It's currently very CPU intensive at the moment, I'm gonna look for ways to reduce CPU usage. May also be memory intensive if you use the `--in-memory` flag. I also haven't tried it on very large repos (i.e. repos with very many many commits)
### Create monorepo locally
```shell
$ git-monorepo init --sources gh:zikani03/articulated,gh:zikani03/pakadali --target toy-projects
```Or with full git urls:
```shell
$ git-monorepo init --sources https://github.com/nndi-oss/ussdproxy,gh:nndi-oss/ussd-whois,https://github.com/nndi-oss/dialoguss --target ussd-projects
```## IDEAS / TODO
- Support "squashing-merging" - that is merge the repos without preserving fine-grained commit history
- Make Git Submodules instead of mangling history
- Clone repositories in parallel
- Create monorepo locally and push to github (and other git hosting services)
```shell
$ git monorepo init --preserve-history \
--sources gh:zikani03/articulated,gh:zikani03/pakadali \
--target gh:zikani03/toy-projects \
--github-token=$GH_TOKEN
```## CREDITS
- [Go-Git](https://pkg.go.dev/github.com/go-git/go-git/v5)
## References
- [Atlassian Monorepos tutorial](https://www.atlassian.com/git/tutorials/monorepos)
- [Git SCM - Appendix B: Embedding Git in your Applications - go-git](https://git-scm.com/book/en/v2/Appendix-B%3A-Embedding-Git-in-your-Applications-go-git)