<?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>Forem: Jeremy</title>
    <description>The latest articles on Forem by Jeremy (@notgrm).</description>
    <link>https://forem.com/notgrm</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%2F59001%2F4da58b49-317d-4dd2-8b4d-f8ec0790441b.jpg</url>
      <title>Forem: Jeremy</title>
      <link>https://forem.com/notgrm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/notgrm"/>
    <language>en</language>
    <item>
      <title>My first Ruby gem is live 🎉</title>
      <dc:creator>Jeremy</dc:creator>
      <pubDate>Thu, 05 Feb 2026 11:05:40 +0000</pubDate>
      <link>https://forem.com/notgrm/my-first-ruby-gem-is-live-4djd</link>
      <guid>https://forem.com/notgrm/my-first-ruby-gem-is-live-4djd</guid>
      <description>&lt;p&gt;Today marks an important milestone in my journey as a developer: I just published my first Ruby gem on RubyGems.&lt;/p&gt;

&lt;p&gt;It's something I've always wanted to do, and I'm really happy to finally check this one off my bucket list.&lt;/p&gt;

&lt;h2&gt;
  
  
  Herb, the future of ERB linting
&lt;/h2&gt;

&lt;p&gt;If you haven't heard of &lt;a href="https://github.com/marcoroth/herb" rel="noopener noreferrer"&gt;Herb&lt;/a&gt; yet, it's &lt;a href="https://marcoroth.dev" rel="noopener noreferrer"&gt;Marco Roth&lt;/a&gt;'s project that aims to treat HTML+ERB as a proper structured language rather than plain text. The project has been getting a lot of well-deserved attention in the Rails community: Marco was named &lt;a href="https://marcoroth.dev/posts/rails-luminary-2025" rel="noopener noreferrer"&gt;Rails Luminary 2025&lt;/a&gt; and Herb was selected for the &lt;a href="https://gem.coop/updates/2026-fellowship/" rel="noopener noreferrer"&gt;Gem Fellowship 2026&lt;/a&gt; by gem.coop.&lt;/p&gt;

&lt;h2&gt;
  
  
  From idea to gem
&lt;/h2&gt;

&lt;p&gt;Since I joined &lt;a href="https://grinta.eu" rel="noopener noreferrer"&gt;Grinta&lt;/a&gt;, I've been wanting to integrate Herb into our CI and say goodbye to erb_lint. Herb has great GitHub Actions support, but we wanted to keep Pronto which allows us to centralize all our linting operations in a single job. The problem: no integration between Pronto and Herb existed.&lt;/p&gt;

&lt;p&gt;So I took advantage of our cooldown cycle to dive in, with my trusty Claude helping me understand Pronto's internals.&lt;/p&gt;

&lt;p&gt;A few hours and bugfixes later, I finally got the result I was after: a Pronto runner for Herb. It analyzes the changes in your PR and surfaces all errors detected by Herb as review comments.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it out
&lt;/h2&gt;

&lt;p&gt;The code is available on &lt;a href="https://github.com/NotGrm/pronto-herb" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;. Feedback and contributions are welcome!&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>erb</category>
      <category>programming</category>
    </item>
    <item>
      <title>Use Bundler in a Ruby script</title>
      <dc:creator>Jeremy</dc:creator>
      <pubDate>Sun, 26 Feb 2023 18:31:42 +0000</pubDate>
      <link>https://forem.com/notgrm/use-bundler-in-a-ruby-script-2dpn</link>
      <guid>https://forem.com/notgrm/use-bundler-in-a-ruby-script-2dpn</guid>
      <description>&lt;p&gt;Sometimes when we write a Ruby script we need to use external gems to integrate with a third party API, or to facilitate the connection to a database. &lt;/p&gt;

&lt;p&gt;For example, if you want to add coloring to produce messages&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'rainbow'&lt;/span&gt;

&lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="no"&gt;Rainbow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"My very important message in red"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;red&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But when deploying this script, how can we ensure that these dependencies will be present? And will they be installed in the expected version for which our script has been tested?&lt;/p&gt;

&lt;p&gt;What to do then? Creating a gem seems too heavy for our script, and it's not advisable to expect users to do the installation by themselves (it's okay for a gem but for a script that would start having 4-5 of them it's a lot).&lt;/p&gt;

&lt;p&gt;Fortunately, Bundler is there for us, in fact, the installer offers a module that we can include in our script and that offers all the features of a &lt;em&gt;Gemfile&lt;/em&gt; but to define our gems inside the script.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'bundler/inline'&lt;/span&gt;

&lt;span class="n"&gt;gemfile&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
  &lt;span class="n"&gt;source&lt;/span&gt; &lt;span class="s1"&gt;'https://rubygems.org'&lt;/span&gt;

  &lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'rainbow'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'~&amp;gt; 3.0.0'&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;

&lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="no"&gt;Rainbow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"My very important message in red"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;red&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thus, when the script is launched, Bundler will check that the declared gems are installed, download them if necessary, and then load them automatically for use.&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>beginners</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>Use Ruby Range with date objects</title>
      <dc:creator>Jeremy</dc:creator>
      <pubDate>Wed, 27 Apr 2022 15:06:23 +0000</pubDate>
      <link>https://forem.com/notgrm/use-ruby-range-with-date-objects-ehk</link>
      <guid>https://forem.com/notgrm/use-ruby-range-with-date-objects-ehk</guid>
      <description>&lt;p&gt;It is quite common to need to define time periods in your application, most often it is modeled by a start date and an end date. Then these dates are compared to the current date for thing like knowing if a customer is a paying member.&lt;/p&gt;

&lt;p&gt;This way of doing often results in methods that could be hard to read&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;paying_member?&lt;/span&gt;
    &lt;span class="n"&gt;subscription_started_at&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="no"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;current&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
      &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;subscription_ended_at&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;nil?&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;subscription_ended_at&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;current&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But there is a way to improve the readability of your code using the Ruby’s Range class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;paying_member?&lt;/span&gt;
    &lt;span class="n"&gt;subscription_period&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cover?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;current&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;

  &lt;span class="kp"&gt;private&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;subscription_period&lt;/span&gt;
    &lt;span class="n"&gt;subscription_started_at&lt;/span&gt;&lt;span class="o"&gt;..&lt;/span&gt;&lt;span class="n"&gt;subscription_ended_at&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the event that the customer do not have terminated its subscription the &lt;code&gt;subscription_period&lt;/code&gt; will return an infinite Range which will also validate our predicate.&lt;/p&gt;

&lt;p&gt;Now let’s say that business consider that the subscription is supposed to be over the day before its stored end date, it is quite simple to modify the &lt;code&gt;subscription_period&lt;/code&gt; method to return a Range that exclude its upper limit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;
  &lt;span class="c1"&gt;# ...&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;subscription_period&lt;/span&gt;
    &lt;span class="n"&gt;subscription_started_at&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="n"&gt;subscription_ended_at&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In a Rails application, it is also possible to take advantage of the methods &lt;code&gt;Range#===&lt;/code&gt; and &lt;code&gt;Range#overlaps?&lt;/code&gt; added to the Range class by &lt;strong&gt;ActiveSupport&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt;
  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;subscriber_kind&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;subscription_period&lt;/span&gt;
    &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="n"&gt;innovator_period&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt; &lt;span class="s1"&gt;'Innovator'&lt;/span&gt;
    &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="n"&gt;early_adopter_period&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt; &lt;span class="s1"&gt;'Early adopter'&lt;/span&gt;
    &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="n"&gt;early_majority_period&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt; &lt;span class="s1"&gt;'Early majority'&lt;/span&gt;
    &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="n"&gt;late_majority_period&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt; &lt;span class="s1"&gt;'Late majority'&lt;/span&gt;
    &lt;span class="k"&gt;when&lt;/span&gt; &lt;span class="n"&gt;laggards_period&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt; &lt;span class="s1"&gt;'Laggard'&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;

  &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;share_subscription_with&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;subscription_period&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;overlaps?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subscription_period&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Links
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://twitter.com/_swanson/status/1313527786326327297?s=20&amp;amp;t=r5nYmj3sW7t2EOCaVP74Jg" rel="noopener noreferrer"&gt;Inspired by Matt Swanson&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://rubyapi.org/3.1/o/range#method-i-last" rel="noopener noreferrer"&gt;Ruby Range API (v3.1)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://guides.rubyonrails.org/active_support_core_extensions.html#extensions-to-range" rel="noopener noreferrer"&gt;Active Support Core Range Extensions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>Review the content of your last Git commit</title>
      <dc:creator>Jeremy</dc:creator>
      <pubDate>Mon, 28 Feb 2022 10:12:56 +0000</pubDate>
      <link>https://forem.com/notgrm/review-the-content-of-your-last-git-commit-10nc</link>
      <guid>https://forem.com/notgrm/review-the-content-of-your-last-git-commit-10nc</guid>
      <description>&lt;p&gt;The other when working on one of my side projects, I needed to review the changes that I have made in my previous commit. For this kind of need, I usually browse to Github to review commits or look for a specific file in VS Code; but I could not use any of these methods as my project did not have a remote repository on Github and I wanted to see all the changes made across the whole project.&lt;/p&gt;

&lt;p&gt;So I fallback to read Git documentation again to finally found the right command to help me review the changes of my last commit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log &lt;span class="nt"&gt;--patch&lt;/span&gt; &lt;span class="nt"&gt;-1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;—patch&lt;/code&gt; option display the commit diff for each commit of my Git history&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;-1&lt;/code&gt; option limit the number of displayed commits to only 1 (the most recent of the current branch)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Author: Jeremy Bertrand &amp;lt;my_email@example.org&amp;gt;
Date:   Fri Feb 18 15:16:31 2022 +0000

    chore: update the database config to support remote db

diff --git a/config/database.yml b/config/database.yml
index da4b691..2d92ba5 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -17,6 +17,9 @@
 default: &amp;amp;default
   adapter: postgresql
   encoding: unicode
+  username: &amp;lt;%= ENV.fetch("POSTGRES_USER") { "pg_user" } %&amp;gt;
+  password: &amp;lt;%= ENV.fetch("POSTGRES_PASSWORD") { "pg_password" } %&amp;gt;
+  host: &amp;lt;%= ENV.fetch("POSTGRES_HOST") { "127.0.0.1" } %&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is also possible to use an other Git command to achieve the same result which can be used to see any Git objects using their reference, and use &lt;code&gt;HEAD&lt;/code&gt; as default value if no object is passed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git show
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;For better rendering of Git diffs, I strongly recommend you to use the &lt;a href="https://github.com/dandavison/delta" rel="noopener noreferrer"&gt;delta utility&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Want more?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History" rel="noopener noreferrer"&gt;Git - Viewing the Commit History&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://git-scm.com/docs/git-show" rel="noopener noreferrer"&gt;Git - git-show Documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>git</category>
      <category>todayilearned</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Inspect a Ruby gem in my editor</title>
      <dc:creator>Jeremy</dc:creator>
      <pubDate>Sun, 26 Sep 2021 16:46:39 +0000</pubDate>
      <link>https://forem.com/notgrm/inspect-a-ruby-gem-in-my-editor-5dip</link>
      <guid>https://forem.com/notgrm/inspect-a-ruby-gem-in-my-editor-5dip</guid>
      <description>&lt;p&gt;&lt;em&gt;Translated from my blog: &lt;a href="https://blog.notgrm.dev/debugger-une-gem-ruby/" rel="noopener noreferrer"&gt;Débugger une gem Ruby&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Sometimes I may have to inspect one of my Ruby (or Rails) project dependency to debug an error, or understand how things works.&lt;/p&gt;

&lt;p&gt;I could open my browser, go to Github.com, and look through the gem repository. But this approach required me know the version used in my project, and it does not allow me to prove that my hypothesizes are valid as I can follow the runtime only in my head.&lt;/p&gt;

&lt;p&gt;OR&lt;/p&gt;

&lt;p&gt;I could also use the &lt;code&gt;bundle open &amp;lt;gem&amp;gt;&lt;/code&gt; command as it will open the downloaded dependency and open its file right in my editor. Opening my project's gem allows me edit its files and saw the changes be applied instantly, for exemple I could puts some debugging breakpoints and inspect the current runtime context of my problem to resolve it.&lt;/p&gt;

&lt;p&gt;Once I have finished my inspection, I can use the &lt;code&gt;bundle pristine &amp;lt;gem&amp;gt;&lt;/code&gt; command to revert any changes made to my project dependency.&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional links
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://bundler.io/v2.2/man/bundle-open.1.html" rel="noopener noreferrer"&gt;The Bundler open command&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://bundler.io/v2.2/man/bundle-pristine.1.html" rel="noopener noreferrer"&gt;The Bundler pristine command&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>todayilearned</category>
      <category>ruby</category>
      <category>rails</category>
      <category>debugging</category>
    </item>
    <item>
      <title>Override Git config based on project path</title>
      <dc:creator>Jeremy</dc:creator>
      <pubDate>Mon, 21 Oct 2019 06:54:58 +0000</pubDate>
      <link>https://forem.com/notgrm/override-git-config-based-on-project-path-4m2m</link>
      <guid>https://forem.com/notgrm/override-git-config-based-on-project-path-4m2m</guid>
      <description>&lt;p&gt;Recently I got a new laptop from my employer that I planned to use for personal projects also. &lt;/p&gt;

&lt;p&gt;The problem that I faced, was that I didn't want my personal email to appear on company projects commit history, nor my professional email on personal projects. &lt;/p&gt;

&lt;p&gt;I could have set my professional email globally and then override it on each of my personal projects. But I am too lazy to do it, and I know that sometimes in the future I will forget to set my personal email in a new project.&lt;/p&gt;

&lt;p&gt;As I take the habit to regroup all personal project under the same folder, I wanted to put a &lt;code&gt;.gitconfig&lt;/code&gt; file in this directory and have it load by Git when I was inside, but it didn't work because Git is only looking for configuration locally (&lt;code&gt;.git/config&lt;/code&gt;) or globally (`~/.gitconfig).&lt;/p&gt;

&lt;p&gt;Finally I found a solution, thanks to a StackOverflow, that since Git version 2.13 it is possible to use &lt;code&gt;includeIf&lt;/code&gt; directive to conditionally include configuration files.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;includeIf&lt;/code&gt; directive accept the two following criteria &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;gitdir: to specify a glob pattern that will be compared to a project &lt;code&gt;.git&lt;/code&gt; folder path&lt;/li&gt;
&lt;li&gt;branch: to specify a branch that will be compared to a project current branch&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When the criteria are met, it includes the file given with the &lt;code&gt;path&lt;/code&gt; parameter&lt;/p&gt;

&lt;p&gt;Whis this new information I was able to set automatically my email for all my personal projects by putting these 2 lines in my &lt;code&gt;~/.gitconfig&lt;/code&gt; file. &lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;
 

&lt;p&gt;&lt;a href="https://media2.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%2F3u0l2sixec2a0iudn7k8.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F3u0l2sixec2a0iudn7k8.gif" width="500" height="280"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Links
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/21307793/set-git-config-values-for-all-child-folders/37167110" rel="noopener noreferrer"&gt;StackOverflow thread who helped me&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://git-scm.com/docs/git-config#_conditional_includes" rel="noopener noreferrer"&gt;Conditionnal includes on Git-SCM&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>git</category>
      <category>productivity</category>
      <category>tips</category>
    </item>
  </channel>
</rss>
