See Ash Code logo See Ash Code

I put the plans in one repository and the application in another

Ashlynn Antrobus
• • 2 min read

The plans for my blog live in blog-meta. The application lives in markdown-blog. My drafts have their own repository too.

I wanted those parts available in one workspace without turning every plan, article, and application change into a commit in the same repository. The initial blog-meta revision connects them with Git submodules.

That gives me a boundary. It also gives me another piece of Git state to remember.

The parent records a revision

The application submodule is checked out under monorepo. The drafts submodule is under drafts. Their repository locations are recorded in .gitmodules.

The parent doesn’t store another ordinary copy of all the application files. It records a particular commit of that repository. In the initial revision, the application pointer is:

blog-meta: c4735286526b6ab9f3d59ad1ab3e84f151aa5c31
monorepo:  526299d8a21e599ded080507cba921b48690665e

That pair tells me which application revision belongs with that parent checkout. Looking at the latest commit on the application’s default branch would answer a different question.

A dragon ties a bookmark in one of three separate notebooks held in a larger folder.

When I change application code, committing it inside monorepo creates an application commit. Updating the pointer in blog-meta is another change, committed in the parent. Until I do that, a fresh checkout of the parent still points at the earlier application revision.

A clean clone has another step

A normal clone of the parent can leave the submodule directory unpopulated. A small disposable example with a one-file application shows the difference: the plain clone leaves the application unpopulated, while the recursive clone checks out its recorded file.

For this workspace, the clone command has this shape:

git clone --recurse-submodules \
    https://github.com/ashrobertsdragon/blog-meta.git \
    blog-workspace

If I’ve already cloned the parent, I can initialize the recorded submodules:

git submodule update --init --recursive

Access still has to work for each repository. Being able to clone a parent doesn’t grant access to a private content repository it references.

This also changes what I mean by a clean checkout. I need to check the parent and the submodules. An application working tree can contain uncommitted changes even while I’m looking at a parent commit that records an older application revision.

The separation has a cost

An application change and the plan describing it can now be reviewed in their respective repositories. But I need to keep the relationship traceable. A plan commit alone doesn’t establish that the application code changed, and an application commit alone doesn’t update the workspace’s recorded pointer.

The submodule gives me an exact link when I maintain it. It doesn’t maintain the link for me.

After updating the application checkout, I still have to commit the new submodule pointer in the parent.

AA

Written by Ashlynn Antrobus

Software developer, author, and builder. Sharing technical lessons learned from building tools like Ebook2Text, IndexedDict, and rag-mcp, and navigating life as a programmer with dyslexia.