Move zet notes to blog posts

Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
Oliver Davies 2025-09-10 08:00:00 +01:00
parent 11ddf3d114
commit 2c517f1d39
34 changed files with 67 additions and 14 deletions

23
source/_posts/21.md Normal file
View file

@ -0,0 +1,23 @@
---
title: Extracting a custom module with a Git subtree
date: 2024-09-04 20:12:00
tags: [Git]
note: true
permalink: /notes/21-extracting-a-custom-module-with-a-git-subtree
---
To extract a directory from a repository and keep the history, you can use the `git subtree split` command to create a new branch:
```shell
git subtree split --prefix=web/modules/custom/my_module --branch=split
Created branch 'split'
17835f24069061326e9e065f076afd67434e1b2f
```
This will create a new branch with just the contents of the given directory.
This can be pushed to a different repository:
```shell
git push git@github.com:opdavies/new-repo.git split:main
```