• Stars
    star
    424
  • Rank 102,329 (Top 3 %)
  • Language
    Shell
  • Created over 4 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Bash scripts for creating a monorepo out of smaller repos.

This repo contains code to combine multiple git repos into a single monolithic repo (a.k.a. a monorepo) while preserving full history, branches, and tags.

The contents of each sub-repo are incorporated with their original history (i.e. every commit to the original repo will exist in the new repo with the same SHA) and all branches and tags will be added, renamed to be prefixed by the name of the repo being added. So if the subrepo is foo.git and it contains a branch whatever, in the monorepo the SHA pointed to by the branch whatever in the original repo will now be pointed to by a branch named foo/whatever.

Additionally the contents of main branch from each sub-repo will be added in a subdirectory named for the sub-repo and merged to the monorepo's main branch. (Or you can specify a different default branch as the second argument to the build script.)

To create a monorepo.

  • Make a file containing the git URLs of the repos you want to combine. These can be paths to bare repos (ideally created with git clone --mirror) or [email protected]: URLs. This file should be named something.repos where something is the name of the new monorepo you want to create.

  • Run ./build something.repos. It will create a directory named something and incorporate all the repos listed in the something.repos file.

  • After the monorepo is built, look for empty-repo.txt and no-branch.txt files in the subdirectories. These are created if the repo incorporated had either no changes (empty-repo.txt) or no main branch. In the latter case the no-branch.txt file will contain a list of the refs from the repo. If there's an appropriate branch (say the repo used prod instead of main) you can fix things up with the pushdown script. In the monorepo remove the no-branch.txt and then run ./pushdown foo/prod to put the contents of the foo/prod branch into the foo subdirectory and merge them to main.

Pushing to GitHub

After you've built your monorepo, you'll probably want to push it to GitHub. In the normal case you can probably just create a repo on GitHub and then do the normal:

git remote add origin [email protected]:<whatever>

Then to push everything:

git push --all origin
git push --tags origin

However, if you made a really big repo, you might get an error about pack files or something when you try to push. This probably means your repo is too big to push in one go. To get around that just push specific branches one at a time. Because your repo was built from smaller repos one good thing to try is pushing the original main branch from each sub repo. For example within the repo you could make a list of all the main branches (except the top-level main which would drag in almost everything at once) with this command.

git branch | grep main | cut -c 3- | egrep -v '^main$' > mains.txt

Then use the slow_push script to push one branch at a time:

cat mains.txt | ./slow_push

This might not push everything (if there were branches in the sub repos that never got merged to main) but it should get most things so that you can then do a:

git push --all origin

to push all the objects and branches.

If the git push --tags origin fails, you may need to push fewer tags at a time. Here's a way to do that assuming you don't already have files named tags.txt or starting with tags- in the root directory of you repo (which you shouldn`t if you just built it).

git tag --list > tags.txt
split -l 100 tags.txt tags-
for f in tags-*; do git push origin $(cat $f); done
rm tags-*
rm tags.txt

More Repositories

1

gg

Implementation of some ideas from ggplot2 on top of d3.js
JavaScript
123
star
2

toot

A web server created by stripping down and reorganizing Edi Weitz's Hunchentoot
Common Lisp
75
star
3

manifest

System for semi-automatically documenting Common Lisp packages.
Common Lisp
34
star
4

scheduler

Code for scheduling meetings on Google calendar.
Python
33
star
5

whistle

A higher-level web server built on top of Toot
Common Lisp
26
star
6

monkeylib-prose-diff

Diff program optimized for comparing text files containing prose.
Common Lisp
24
star
7

monkeylib-utilities

Various CL utilities that I use all the time.
Common Lisp
17
star
8

monkeylib-binary-data

Binary data library based on code from chapter 24 of Practical Common Lisp
Common Lisp
17
star
9

yamp

Yet Another Markup Parser
Common Lisp
14
star
10

monkeylib-bcrypt

Common Lisp wrapper for Openwall bcrypt password hashing library.
Common Lisp
14
star
11

pcl-practicals

Example code from Practical Common Lisp
Common Lisp
13
star
12

monkeylib-markup

Markup text markup language.
Common Lisp
12
star
13

haskell-markup

Haskell implementation of a Markup processing system.
Haskell
11
star
14

monkeylib-parser

Parser generator loosely based on Baker's META paper.
Common Lisp
10
star
15

python-format

Python implementation of CL FORMAT
Python
9
star
16

markup

The Gigamonkey Markup language
Ruby
8
star
17

monkeylib-macro-utilities

A few utilities for writing macros.
Common Lisp
7
star
18

jumper

Elisp for making M-. work the way I like.
Emacs Lisp
7
star
19

nanowrimo-elisp

Elisp for computing word-count statistics during NaNoWriMo
Emacs Lisp
6
star
20

gigamonkey-tic-tac-toe

Simple python tic-tac-toe implementation.
Python
6
star
21

writing-elisp

Elisp I use for writing prose.
Emacs Lisp
6
star
22

vamonos

go/link style link shortener.
Python
6
star
23

openwall-bcrypt

Openwall's implementation of bcrypt password hashing algorithm
C
6
star
24

monkeylib-foo

Foo Outputs Output -- HTML generation.
Common Lisp
5
star
25

monkeylib-json

Json input and output code.
Common Lisp
5
star
26

jira-db

Pull info from Jira and put it into a real database.
Python
5
star
27

swankr

Fork of Christophe Rhodes's SWANKR
R
5
star
28

monkeylib-spam

Spam filter based on code from chapter 23 of Practical Common Lisp
Common Lisp
5
star
29

advent-of-code-2015

Solutions to Advent of Code problems.
Haskell
5
star
30

bot

Chat bot originally based on AIML.
Common Lisp
5
star
31

monkeylib-text-languages

Framework for building languages that can be output using monkeylib-text-output.
Common Lisp
5
star
32

go

A system for breeding critters to play Go.
HTML
4
star
33

chrome-extensions

Chrome extensions. Currently mostly for dealing with my tab problem.
JavaScript
4
star
34

monkeylib-html

HTML generation on top of monkeylib-text-languages.
Common Lisp
4
star
35

monkeylib-text-output

Framework for generating simply formatted text output.
Common Lisp
4
star
36

trumpet

A blog framework built on top of whistle.
Common Lisp
4
star
37

orgchart

D3-based historical org chart viewer.
JavaScript
3
star
38

quicklisp-distcompiler

Some CL code for generating Quicklisp dists
Common Lisp
3
star
39

rfc2388

Common Lisp
3
star
40

snake

Snake in JS.
JavaScript
3
star
41

monkeylib-atom

ATOM generator
Common Lisp
3
star
42

repl

A proof of concept in-browser Javascript REPL.
JavaScript
3
star
43

monkeylib-markup-html

Generate HTML from Monkeylib Markup
Common Lisp
3
star
44

monkeylib-markup-xml

Generate XML from Monkeylib Markup
Common Lisp
3
star
45

ai-notes

Common Lisp
3
star
46

monkeylib-pathnames

My pathname functions. The basis for cl-fad.
Common Lisp
3
star
47

bazelize

Somes scripts to help in converting an sbt project to Bazel.
Shell
2
star
48

review

Elisp for inserting code review comments.
Emacs Lisp
2
star
49

dungeon

Text based adventure game.
Java
2
star
50

haskell-sudoku

2014 Q3 Twitter Hackweek -- My First Haskell Program
Haskell
2
star
51

sudoku

Some sudoku code based on Norvig's Solve every Sudoku essay for a Girls Who Code course at Twitter.
Python
2
star
52

monkeylib

Monorepo version of all the old monkeylib-* repos.
Common Lisp
2
star
53

monkeylib-statistics

A few simple functions for computing statistics.
Common Lisp
2
star
54

monkeylib-test-framework

Test framework based on code in PCL
Common Lisp
2
star
55

ear-training

Pygame based MIDI ear trainer.
Python
2
star
56

boggle

Java
1
star
57

facecards

Flashcard program for learning studentsโ€™ names.
JavaScript
1
star
58

haskell-skirt

Haskell implementation of Skirt, my wrapper around Pants.
Haskell
1
star
59

wordl

JavaScript
1
star
60

change

Change counting code.
Haskell
1
star
61

itp-tools

Various tools I'm building for Intro to Programming course.
JavaScript
1
star
62

skirt

Wrapper around pants.
Shell
1
star
63

monkeydist

Source for generating my own Quicklisp dist with my quicklisp-distcompiler.
1
star
64

query-split

September 2013 coding challenge
Common Lisp
1
star
65

parseltongue

Python PEG parsing framework.
Python
1
star
66

advent-of-code-2020

2020 Advent of Code
Python
1
star
67

bouncing-ball

Simple bouncing ball program for intro to programming class.
JavaScript
1
star
68

monkeycheck

My own hacking around reimplementation of scalacheck because reasons.
Scala
1
star
69

quiz

Somewhat generic quiz engine for learning things like math facts and vocabulary.
Haskell
1
star