Description
Overleaf has migrated all of its active repositories into a monorepo to ease
the developer experience when making changes in multiple places for a new
feature.
We used this opportunity to change our default branch from master
to main
as
well.
The new home of the public code will be overleaf/overleaf
on GitHub.
The existing repositories will get archived on GitHub. This will retain
read-only access to pull-requests, issues and code (with old git SHAs).
Services like chat
or web
will be located in monorepo/services/chat
/
monorepo/services/web
, libraries like o-error
in
monorepo/libraries/o-error
and server-ce
on top-level monorepo/server-ce
.
The integration of all the repositories required rewriting the history for a
proper git-log experience in individual files/directories.
This in turn changes all the git-hashes of commits.
Unfortunately the community will not be able to pull new changes or merge
our main branch into forks.
Instead a new/forced checkout of the repository is needed, and changes to code
will need to be rebased.
In most cases a rebase can get changes into the new home and git will detect
that files have been moved. Example for migrating a web branch.
web$ git checkout BRANCH-NAME
web$ git fetch origin master
web$ git rebase origin/master
monorepo$ git remote add import-web /path/to/web
monorepo$ git fetch import-web BRANCH-NAME
monorepo$ git fetch import-web master
monorepo$ git checkout BRANCH-NAME
monorepo$ git rebase --onto main import-web/master
monorepo$ git remote remove import-web
This will migrate the changes to existing files to the files in their new
location.
However it will not be able to move newly created files to the new directories.
These will need to moved explicitly, e.g. as part of an interactive rebase
(add --interactive
to the second rebase command and pause when a commit added
a new file, move it to the new place, git stage
everything and resume
rebasing).