<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lorenzo Arena</title>
    <description>The latest articles on DEV Community by Lorenzo Arena (@lorenzoarena).</description>
    <link>https://dev.to/lorenzoarena</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F116123%2F2f9a1269-3210-4c96-ae1b-b0cfab4c6e43.jpg</url>
      <title>DEV Community: Lorenzo Arena</title>
      <link>https://dev.to/lorenzoarena</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lorenzoarena"/>
    <language>en</language>
    <item>
      <title> First steps with the kas build system</title>
      <dc:creator>Lorenzo Arena</dc:creator>
      <pubDate>Wed, 03 Nov 2021 11:19:23 +0000</pubDate>
      <link>https://dev.to/lorenzoarena/first-steps-with-the-kas-build-system-37hn</link>
      <guid>https://dev.to/lorenzoarena/first-steps-with-the-kas-build-system-37hn</guid>
      <description>&lt;p&gt;I often work with the &lt;a href="https://www.yoctoproject.org/" rel="noopener noreferrer"&gt;Yocto Project&lt;/a&gt; to build custom Linux distributions for a&lt;br&gt;
various range of products. One of the main struggles you can have while working with this tool is managing multiple&lt;br&gt;
git repositories in order to produce a successful build. A new tool called &lt;a href="https://github.com/siemens/kas" rel="noopener noreferrer"&gt;kas&lt;/a&gt; tries&lt;br&gt;
to simplify this process; let's see how by building a distribution for a Pine64 board.&lt;/p&gt;
&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;First, we must install python3 and pip, together with some other dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;python3 python3-pip
&lt;span class="nv"&gt;$ &lt;/span&gt;pip3 &lt;span class="nb"&gt;install &lt;/span&gt;distro jsonschema PyYAML
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then install kas; I had a problem with a dependency so I had to install another package by hand&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;pip3 &lt;span class="nb"&gt;install &lt;/span&gt;testresources
&lt;span class="nv"&gt;$ &lt;/span&gt;pip3 &lt;span class="nb"&gt;install &lt;/span&gt;kas
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Running a simple build
&lt;/h2&gt;

&lt;p&gt;As an example, we can try to build a simple image for the qemu machine which is already contained in the poky&lt;br&gt;
repository. We need to create a special file, &lt;em&gt;kas-project.yml&lt;/em&gt;, which will describe how our distribution must be built&lt;br&gt;
and which layers must be included; we will use the file provided by the kas documentation, with some small tweaks.&lt;br&gt;
Create a folder for the project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;kas-pine64
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;touch &lt;/span&gt;kas-project.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add the following snippet to the project configuration file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;header&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
   &lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;11&lt;/span&gt;
&lt;span class="na"&gt;machine&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;qemux86-64&lt;/span&gt;
&lt;span class="na"&gt;distro&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;poky&lt;/span&gt;
&lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;core-image-minimal&lt;/span&gt;
&lt;span class="na"&gt;repos&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
   &lt;span class="na"&gt;kas-pine64&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
   &lt;span class="na"&gt;poky&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
   &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://git.yoctoproject.org/git/poky"&lt;/span&gt;
   &lt;span class="na"&gt;refspec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;hardknott&lt;/span&gt;
   &lt;span class="na"&gt;layers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
   &lt;span class="na"&gt;meta&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
   &lt;span class="na"&gt;meta-poky&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
   &lt;span class="na"&gt;meta-yocto-bsp&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="na"&gt;local_conf_header&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
   &lt;span class="na"&gt;kas-pine64&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
   &lt;span class="s"&gt;EXTRA_IMAGE_FEATURES += "debug-tweaks"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;em&gt;kas-project.yml&lt;/em&gt; file is written in &lt;a href="https://en.wikipedia.org/wiki/YAML" rel="noopener noreferrer"&gt;YAML&lt;/a&gt;, a minimal markup language often&lt;br&gt;
used for configuration files. It allows us to describe our distribution in a very clear way; in this example we will be&lt;br&gt;
building the &lt;em&gt;core-image-minimal&lt;/em&gt; image based on the &lt;em&gt;poky&lt;/em&gt; distribution for a &lt;em&gt;qemux86-64&lt;/em&gt; machine. The layer used are&lt;br&gt;
the ones contained in the &lt;em&gt;poky&lt;/em&gt; layer, listed in the configuration file. The &lt;code&gt;local_conf_header&lt;/code&gt; section allows&lt;br&gt;
us to add any line to the &lt;em&gt;local.conf&lt;/em&gt; file in the build folder.&lt;/p&gt;

&lt;p&gt;We can now use one of the available &lt;em&gt;kas&lt;/em&gt; commands, &lt;code&gt;build&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;kas build kas-project.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;kas will clone the repositories indicated in out project file (just poky in this case) and start the build process&lt;br&gt;
using &lt;code&gt;bitbake&lt;/code&gt; for the &lt;em&gt;distro&lt;/em&gt; and &lt;em&gt;machine&lt;/em&gt; we set; at the end of the build process we will have a &lt;em&gt;build&lt;/em&gt;&lt;br&gt;
folder with the same structure of any Yocto project build.&lt;/p&gt;
&lt;h2&gt;
  
  
  Other kas commands
&lt;/h2&gt;

&lt;p&gt;One other useful kas command is &lt;code&gt;shell&lt;/code&gt;. We can run it like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;kas shell kas-project.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and what it does is it opens a new shell instance with the build environment loaded. We can also provide a custom&lt;br&gt;
command to execute inside the new shell; for example to replicate the previous build command, we could run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;kas shell kas-project.yml &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="s2"&gt;"bitbake core-image-minimal"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Since we are running through the basic Yocto demo, we can now try to load the virtual QEMU image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;kas shell kas-project.yml
&lt;span class="nv"&gt;$ &lt;/span&gt;runqemu qemux86-64 core-image-minimal nographic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It will prompt for the admin password to create the tap interfaces, then, after the boot sequence, we can login with&lt;br&gt;
"root" (since we enabled &lt;code&gt;debug-tweaks&lt;/code&gt; in the project file). I also tried graphic mode but for some reason the&lt;br&gt;
GUI never appears, maybe for some restrictions coming from the kas environment.&lt;/p&gt;
&lt;h2&gt;
  
  
  Integrating with more layers
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fybl9jaluiugrcep6mld3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fybl9jaluiugrcep6mld3.jpg" alt="The Pine A64 board"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now let's add some more layers to build an image for a real board, the&lt;br&gt;
&lt;a href="https://www.pine64.org/devices/single-board-computers/pine-a64-lts/" rel="noopener noreferrer"&gt;Pine A64&lt;/a&gt;. Under the "repos" section of the&lt;br&gt;
configuration file, add the following lines:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;   &lt;span class="na"&gt;meta-openembedded&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
     &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://github.com/openembedded/meta-openembedded.git"&lt;/span&gt;
     &lt;span class="na"&gt;refspec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;hardknott&lt;/span&gt;
     &lt;span class="na"&gt;layers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
       &lt;span class="na"&gt;meta-oe&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
   &lt;span class="na"&gt;meta-sunxi&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
     &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https://github.com/linux-sunxi/meta-sunxi.git"&lt;/span&gt;
     &lt;span class="na"&gt;refspec&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;hardknott&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can add also one custom layer; it could be fetched from a private git repository, but it can be a simple folder in&lt;br&gt;
the project structure as well:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;meta-custom-pine64
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create also a &lt;em&gt;meta-custom-pine64/conf/layer.conf&lt;/em&gt; file for our custom layer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# We have a conf and classes directory, add to BBPATH
BBPATH .= ":${LAYERDIR}"

# We have recipes-* directories, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
            ${LAYERDIR}/recipes-*/*/*.bbappend"

BBFILE_COLLECTIONS += "meta-custom-pine64"
BBFILE_PATTERN_meta-custom-pine64 = "^${LAYERDIR}/"
BBFILE_PRIORITY_meta-custom-pine64 = "10"

LAYERDEPENDS_meta-custom-pine64 = ""
LAYERSERIES_COMPAT_meta-custom-pine64 = "hardknott"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can then add a new custom image creating the &lt;em&gt;meta-custom-pine64/recipes-images/images/kas-custom-image.bb&lt;/em&gt; recipe:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SUMMARY = "kas custom image"
LICENSE = "MIT"

inherit core-image

IMAGE_FEATURES += "ssh-server-openssh"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set the image as the build target by changing it in the project configuration file, and add the new layers as well; the&lt;br&gt;
machine can be set to &lt;code&gt;pine64-plus&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;...&lt;/span&gt;
&lt;span class="na"&gt;machine&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pine64-plus&lt;/span&gt;
&lt;span class="na"&gt;distro&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;poky&lt;/span&gt;
&lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;kas-custom-image&lt;/span&gt;
&lt;span class="nn"&gt;...&lt;/span&gt;
&lt;span class="c1"&gt;# Add the new layer in our project section&lt;/span&gt;
&lt;span class="na"&gt;repos&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;kas-pine64&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;layers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;meta-custom-pine64&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The build process can be run again with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;kas build kas-project.yml
   &lt;span class="c"&gt;# Once the build process ends, we can flash the image&lt;/span&gt;
   &lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;build/tmp/deploy/images/pine64-plus/
   &lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo dd &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;kas-custom-image-pine64-plus.sunxi-sdimg &lt;span class="nv"&gt;of&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/dev/sd&amp;lt;X&amp;gt; &lt;span class="nv"&gt;bs&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;1024 &lt;span class="nv"&gt;status&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;progress
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we boot the board using the flashed SD image, we will have a system with a basic image and an ssh server; this can&lt;br&gt;
work as a canvas for more structured projects.&lt;/p&gt;

&lt;p&gt;A small note: at the time of writing there is an issue with U-Boot in&lt;br&gt;
&lt;a href="https://github.com/linux-sunxi/meta-sunxi" rel="noopener noreferrer"&gt;meta-sunxi&lt;/a&gt; for the pine64-plus machine; I opened a&lt;br&gt;
&lt;a href="https://github.com/linux-sunxi/meta-sunxi/pull/330" rel="noopener noreferrer"&gt;pull request&lt;/a&gt; to fix that; apply that patch if you want to try to&lt;br&gt;
build the project.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>yocto</category>
      <category>kas</category>
    </item>
    <item>
      <title> How to extract a project from a git repository</title>
      <dc:creator>Lorenzo Arena</dc:creator>
      <pubDate>Wed, 03 Nov 2021 11:14:47 +0000</pubDate>
      <link>https://dev.to/lorenzoarena/how-to-extract-a-project-from-a-git-repository-3hj5</link>
      <guid>https://dev.to/lorenzoarena/how-to-extract-a-project-from-a-git-repository-3hj5</guid>
      <description>&lt;p&gt;The story of how I came into the undocumented &lt;code&gt;git subtree&lt;/code&gt; command to help bring back order to an unfortunate&lt;br&gt;
repository.&lt;/p&gt;
&lt;h2&gt;
  
  
  A little bit of background
&lt;/h2&gt;

&lt;p&gt;It can happen to make wrong choices; in the programming field, in particular, what often happens is that the&lt;br&gt;
consequences arrive suddenly and like an unstoppable escalation. But catastrophisms aside, we come to a need born a few&lt;br&gt;
days ago: in one of the git repositories that I use, which had to act as a "warehouse" for some small utilities, the&lt;br&gt;
situation has exploded. Managing 15 small projects in a single versioning solution is a real nightmare, so I decided to&lt;br&gt;
try to solve the situation, possibly without simply creating new repositories to start from scratch with the commit&lt;br&gt;
history copied into them.&lt;/p&gt;

&lt;p&gt;After a little bit of digging, I found a tool which I didn't know anything about: &lt;strong&gt;subtree&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Subtree is a script created by extern contributors in the git community and it's bundled in the git installation from&lt;br&gt;
version &lt;em&gt;1.7.11&lt;/em&gt;, but never added to the official documentation (you can, however, read some informations&lt;br&gt;
&lt;a href="https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt"&gt;here&lt;/a&gt;). It allows one to create&lt;br&gt;
&lt;em&gt;subtrees&lt;/em&gt;, which are branches that will join the ones already existent but in an independent manner, creating something&lt;br&gt;
like a new repository in the repository.&lt;/p&gt;

&lt;p&gt;Subtree also offers some commands which enables the execution of really interesting operations: one of them is&lt;br&gt;
&lt;code&gt;split&lt;/code&gt;, which will create a new branch that will contain the commit history of a subfolder in particular. That&lt;br&gt;
seems exactly what we need!&lt;/p&gt;

&lt;p&gt;Let's suppose that the starting repository has a folder structure like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   repository
   │   .git
   │   .gitignore
   │
   └───project1
   │   │   file1_1
   │   │   file1_2
   │
   └───project2
   │   │   file2_1
   │   │   file2_2
   │
   └───project3
   │   │   file3_1
   │   │   file3_2
   │
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now if we wanted to extract the &lt;em&gt;project1&lt;/em&gt; folder we can go like this: first we must create a subtree which will contain&lt;br&gt;
only the commits involving files inside &lt;em&gt;project1&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git subtree &lt;span class="nb"&gt;split&lt;/span&gt; &lt;span class="nt"&gt;--prefix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;project1 &lt;span class="nt"&gt;-b&lt;/span&gt; split-branch-project1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, we can move into another folder and create the future repository&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;project1
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;project1
&lt;span class="nv"&gt;$ &lt;/span&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's execute a pull from the old repository, referencing the newly created branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;git pull ~/repository split-branch-project1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point &lt;em&gt;project1&lt;/em&gt; will contain only the commit history involving that project; by repeating the process for each&lt;br&gt;
project we can have cleaner repositories without losing the history.&lt;/p&gt;

</description>
      <category>git</category>
      <category>programming</category>
      <category>subtree</category>
    </item>
  </channel>
</rss>
