Git X-Modules Demo Project

If you would like to try out Git X-Modules, but don’t have a spare Bitbucket Server handy – there’s a demo project for you!

URL: https://test.tmatesoft.com/projects/GXM
Login / Password (optional): Demo.User / X-Modules

There are 5 repositories in this project:

2020-07-05_19-13-50

  • Backend” and “Frontend” represent two different projects that may exist within a product.
  • Shared Libraries1 and 2 represent source code, that is used both in “Backend” and “Frontend”.
  • Monorepo” is a special repository that contains all code there is.

First, look at the “Backend”. It has three directories – “src”, “lib1” and “lib2”.

  • “Src” is the code, specific for this project.
  • “Lib1” is a special directory, that is synced with another repository – “Shared Library 1”. All changes made in “Shared Library 1” will be immediately implemented in this directory. This is called an X-Module.
  • “Lib2” is also an X-Module – a directory, synced with “Shared Library 2”.

2020-07-05_19-53-25

Now, look at the “Frontend”. It has a similar structure, and also two X-Modules – same, as the “Backend”. So “Shared Libraries” and synced with directories in “Backend” and “Frontend” at the same time.

Splitting the code between many lightweight repositories makes the work faster, but sometimes you need to have all in one place – for example, to avoid discrepancy in production. This is called a “monorepo” approach and has its benefits and shortcomings. Now you can create a monorepo with Git X-Modules!

Look at the “Monorepo” repository. It doesn’t have its own source code – instead, it has four directories, each of them synced with one of the other repositories.

“Monorepo” is a repository, build of X-Modules. And still it’s a regular Git repository and you can use it as such.

All commits to a repository, synced with an X-Module (e.g. “Shared Library 1”) are reflected in the commit history of the X-Module repository (e.g. “Backend”). Note, that different X-Modules may have different merge strategies – it affects, how these commits from the external repository are represented. Read more about it here.

And the commit history of the “Monorepo” is composed entirely of the commits, made to four other repositories. Check it out yourself!

Feel free to play with these setups. You may create new commits in any of the synced repositories and see them appear in the others. You may even create new X-Modules, if you wish! Just remember: at 2am CEST all repositories will be replaced with clean copies, and your commits will disappear. It’s a demo, after all.

Have fun!