monorepo

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2022 License: MIT Imports: 14 Imported by: 0

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.

$ 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
$ git-monorepo init --sources gh:zikani03/articulated,gh:zikani03/pakadali --target toy-projects

Or with full git urls:

$ 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)

$ git monorepo init --preserve-history \ 
  --sources gh:zikani03/articulated,gh:zikani03/pakadali \ 
  --target gh:zikani03/toy-projects \ 
  --github-token=$GH_TOKEN

CREDITS

References

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Monorepo

type Monorepo struct {
	// done chan bool
	Dir                  string
	SourceRepositoryURLs []string
	UseInMemoryStorage   bool
}

func NewMonorepoFromSources

func NewMonorepoFromSources(repos []string) *Monorepo

func NewMonorepoFromSourcesInMemory added in v0.2.0

func NewMonorepoFromSourcesInMemory(repos []string) *Monorepo

func (*Monorepo) Init

func (m *Monorepo) Init(targetDir string) error

type RepositoryCommit

type RepositoryCommit struct {
	*object.Commit
	RepositoryName string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳