<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title>Chemaclass - git</title><subtitle>Tech Lead sharing practical insights on software craftsmanship, TDD, leadership, Bitcoin, and AI. Blog posts, book summaries, and conference talks.</subtitle><link rel="self" type="application/atom+xml" href="https://chemaclass.com/tags/git/atom.xml"/><link rel="alternate" type="text/html" href="https://chemaclass.com"/><generator uri="https://www.getzola.org/">Zola</generator><updated>2024-11-17T00:00:00+00:00</updated><id>https://chemaclass.com/tags/git/atom.xml</id><entry xml:lang="en"><title>Verified Git Commits</title><subtitle>Boosting trust and security in your codebase</subtitle><category term="git" scheme="https://chemaclass.com/tags/git/" label="Git"/><category term="security" scheme="https://chemaclass.com/tags/security/" label="Security"/><category term="cryptography" scheme="https://chemaclass.com/tags/cryptography/" label="Cryptography"/><category term="open-source" scheme="https://chemaclass.com/tags/open-source/" label="Open Source"/><published>2024-11-17T00:00:00+00:00</published><updated>2024-11-17T00:00:00+00:00</updated><author><name>
Chemaclass</name></author><link rel="alternate" type="text/html" href="https://chemaclass.com/blog/verified-git-commits/"/><id>https://chemaclass.com/blog/verified-git-commits/</id><summary type="html">Sign your Git commits with GPG to prove they are really yours. Without a signature, anyone can fake a commit using your email.</summary><content type="html">&lt;p>When it comes to software development, &lt;a href="/readings/the-five-dysfunctions-of-a-team/">trust&lt;/a> and security are very important. One easy way to level up both is by using verified commits.&lt;/p>
&lt;span id="continue-reading">&lt;/span>
&lt;p>Whether you’re working on an &lt;a href="/blog/open-source-software/">open-source&lt;/a> project or in a private company, verified commits can make sure your contributions are legit. Let’s break down what they are, why they’re important, and how to start using them.&lt;/p>
&lt;h2 id="what-are-verified-commits">What are verified commits?
&lt;a class="heading-anchor" href="#what-are-verified-commits" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;p>A verified commit is basically a Git commit that is signed by the author using a digital signature. This signature proves that the commit actually came from the person who says they made it. Tools like &lt;a rel="external" href="https://gnupg.org/">GPG (GNU Privacy Guard)&lt;/a> let you attach this signature to your commits.&lt;/p>
&lt;p>If you’re using platforms like GitHub, you’ll notice a little “Verified” badge next to commits that are signed properly. It’s a quick way to show that the commit is authentic.&lt;/p>
&lt;p>&lt;img src="/images/blog/2024-11-17/verified-commit-example.webp" alt="Three bashunit commits on GitHub, each carrying a green Verified badge" />&lt;/p>
&lt;h2 id="why-are-they-important">Why Are They Important?
&lt;a class="heading-anchor" href="#why-are-they-important" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;p>Signed commits help keep your contributions authentic and trustworthy. By adding a cryptographic signature to your commits, you prove that the changes came from you. This is especially important in collaborative environments, where maintaining trust and accountability is key.&lt;/p>
&lt;p>Without signed commits, anyone could fake a commit using someone else’s email. For example, they could use your email, and platforms like GitHub would link it to your profile, making it look like you made the changes, even if you didn’t… not good!&lt;/p>
&lt;p>&lt;img src="/images/blog/2024-11-17/impersonating-commit.webp" alt="Terminal running git commit -m “impersonating commit - do not do this”" />&lt;/p>
&lt;p>&lt;img src="/images/blog/2024-11-17/impersonating-commit4.webp" alt="The forged commit on GitHub attributed to torvalds, with Linus Torvalds’ profile card open" />&lt;/p>
&lt;p>By signing your commits, you show that the work is genuinely yours. It stops impersonation, builds trust in what you’ve done, and keeps everything transparent and accountable.&lt;/p>
&lt;blockquote>
&lt;p>&lt;small>Note: For this demo, I used a public email address belonging to Linus Torvalds. After pushing the commit to this repository, GitHub recognized the email and linked it to his profile. This impersonation is purely for demo purposes to highlight potential risks. Always use your own email for commits.&lt;/small>&lt;/p>
&lt;/blockquote>
&lt;hr />
&lt;h2 id="how-to-get-started-with-verified-commits">How to get started with verified commits
&lt;a class="heading-anchor" href="#how-to-get-started-with-verified-commits" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;h3 id="set-up-a-gpg-key">Set up a GPG key
&lt;a class="heading-anchor" href="#set-up-a-gpg-key" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;p>First, you’ll need a GPG key to start signing commits. Here’s how:&lt;/p>
&lt;p>Generate a GPG key:&lt;/p>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="shellscript">&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">gpg&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);"> -&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);">-full-generate-key&lt;/span>&lt;/span>&lt;/code>&lt;/pre>
&lt;p>Find your key ID:&lt;/p>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="shellscript">&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">gpg&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);"> -&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);">-list-secret-keys&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);"> -&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);">-keyid-format=long&lt;/span>&lt;/span>&lt;/code>&lt;/pre>
&lt;p>Tell Git to use your key:&lt;/p>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="shellscript">&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">git&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> config&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);"> -&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);">-global&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> user.signingkey&lt;/span>&lt;span style="color: light-dark(#D73A49, #F97583);"> &amp;lt;&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);">your-key-i&lt;/span>&lt;span>d&lt;/span>&lt;span style="color: light-dark(#D73A49, #F97583);">&amp;gt;&lt;/span>&lt;/span>&lt;/code>&lt;/pre>
&lt;p>Make signing commits the default:&lt;/p>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="shellscript">&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">git&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> config&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);"> -&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);">-global&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> commit.gpgsign&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);"> true&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;h3 id="add-your-key-to-github-gitlab">Add your key to &lt;a rel="external" href="https://github.com/settings/keys">GitHub&lt;/a>/&lt;a rel="external" href="https://docs.gitlab.com/user/project/repository/signed_commits/gpg/">GitLab&lt;/a>
&lt;a class="heading-anchor" href="#add-your-key-to-github-gitlab" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;p>Export your public key:&lt;/p>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="shellscript">&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">gpg&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);"> -&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);">-armor&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);"> -&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);">-export&lt;/span>&lt;span style="color: light-dark(#D73A49, #F97583);"> &amp;lt;&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);">your-key-i&lt;/span>&lt;span>d&lt;/span>&lt;span style="color: light-dark(#D73A49, #F97583);">&amp;gt;&lt;/span>&lt;/span>&lt;/code>&lt;/pre>
&lt;p>Navigate to “Settings &amp;gt; SSH and GPG keys,” and paste your key.&lt;/p>
&lt;p>&lt;img src="/images/blog/2024-11-17/gpg-keys.webp" alt="The GPG keys page in GitHub settings, listing a work key and a personal key" />&lt;/p>
&lt;h3 id="start-signing-commits">Start signing commits
&lt;a class="heading-anchor" href="#start-signing-commits" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;p>From now on, Git will automatically sign your commits.&lt;/p>
&lt;p>If you want to sign a commit manually, just use the &lt;code>-S&lt;/code> flag:&lt;/p>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="shellscript">&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">git&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> commit&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);"> -&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);">S&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);"> -&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);">m&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> &amp;quot;&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);">Your commit message&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);">&amp;quot;&lt;/span>&lt;/span>&lt;/code>&lt;/pre>
&lt;p>You can &lt;strong>verify&lt;/strong> the commit signature with:&lt;/p>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="shellscript">&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">git&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> log&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);"> -&lt;/span>&lt;span style="color: light-dark(#005CC5, #79B8FF);">-show-signature&lt;/span>&lt;/span>&lt;/code>&lt;/pre>
&lt;p>And also when clicking on the “Verified” badge on GitHub directly.&lt;/p>
&lt;p>&lt;img src="/images/blog/2024-11-17/gpg-verify.webp" alt="GitHub’s Verified popover naming the GPG key ID that signed the commit and the date it was verified" />&lt;/p>
&lt;p>Verified commits might seem like a small step, but they make your code more trustworthy. It’s an easy way to add an extra layer of protection to your work, and it’s worth it. Give it a try!&lt;/p>
&lt;hr />
&lt;h3 id="extra-full-setup-in-spanish-es">Extra: Full setup in Spanish 🇪🇸
&lt;a class="heading-anchor" href="#extra-full-setup-in-spanish-es" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;div style="position:relative;aspect-ratio:16/9;width:100%;">
&lt;iframe
src="https://www.youtube-nocookie.com/embed/0DzQBu7U2f4"
title="YouTube video"
width="560"
height="315"
loading="lazy"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
referrerpolicy="strict-origin-when-cross-origin"
style="position:absolute;inset:0;width:100%;height:100%;border:0;"
allowfullscreen>
&lt;/iframe>
&lt;/div>
&lt;hr />
&lt;p>&lt;strong>Related links&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>Learn more: &lt;a href="/pgp">What is PGP encryption?&lt;/a> &lt;small>A 3-minute tutorial for beginners&lt;/small>&lt;/li>
&lt;/ul></content></entry><entry xml:lang="en"><title>Open-Source Software</title><subtitle>The power of contributing to OSS</subtitle><category term="open-source" scheme="https://chemaclass.com/tags/open-source/" label="Open Source"/><category term="git" scheme="https://chemaclass.com/tags/git/" label="Git"/><category term="career" scheme="https://chemaclass.com/tags/career/" label="Career"/><category term="productivity" scheme="https://chemaclass.com/tags/productivity/" label="Productivity"/><published>2021-05-03T00:00:00+00:00</published><updated>2021-05-03T00:00:00+00:00</updated><author><name>
Chemaclass</name></author><link rel="alternate" type="text/html" href="https://chemaclass.com/blog/open-source-software/"/><id>https://chemaclass.com/blog/open-source-software/</id><summary type="html">A practical guide to open-source software: its benefits, how to start contributing, and why sharing code accelerates your career growth.</summary><content type="html">&lt;p>Every project you ship stands on open-source software. Your framework, your test runner, your compiler, the small library you never think about.&lt;/p>
&lt;p>You use it every day. The real question is whether you ever give back.&lt;/p>
&lt;span id="continue-reading">&lt;/span>
&lt;p>Giving back is not charity. It is one of the fastest ways to grow as a developer.&lt;/p>
&lt;h2 id="what-is-oss">What is OSS?
&lt;a class="heading-anchor" href="#what-is-oss" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;p>Open-source is not the same as free software. Free software is one kind of open-source, but open-source does not have to be free to use. Two examples draw the line. &lt;a rel="external" href="https://github.com/sebastianbergmann/phpunit/blob/master/LICENSE">PHPUnit&lt;/a> is open-source and free. &lt;a rel="external" href="https://github.com/spryker/spryker-core/blob/master/LICENSE">Spryker&lt;/a> is open-source and paid. Both publish their code for anyone to read.&lt;/p>
&lt;blockquote>
&lt;p>OSS is software that is public, open to the world.&lt;/p>
&lt;/blockquote>
&lt;h2 id="benefits">Benefits
&lt;a class="heading-anchor" href="#benefits" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;p>Two groups win from open-source: the companies that publish it, and the people who contribute.&lt;/p>
&lt;h3 id="for-companies">For companies
&lt;a class="heading-anchor" href="#for-companies" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;p>Open access drives adoption. The easier the code is to get, the faster people build on it. Training and tutorials pull in newcomers and grow the ecosystem. The code tends to sit on the cutting edge, because software that stands still goes obsolete. A public project gathers a community around it, and public channels make that community easy to join.&lt;/p>
&lt;p>And because anyone can read the source, anyone can check its quality. That is trust you cannot fake.&lt;/p>
&lt;h3 id="for-individual-contributors">For individual contributors
&lt;a class="heading-anchor" href="#for-individual-contributors" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;p>You pick what you work on. You practice real skills without the pressure of a production outage. You get to play with the newest features of your language, or try a language you have never touched.&lt;/p>
&lt;p>You also sharpen the soft skills that carry a career: writing clearly, explaining a change, holding your ground when people disagree.&lt;/p>
&lt;blockquote>
&lt;p>The code teaches the hard skills. The disagreements teach the rest.&lt;/p>
&lt;/blockquote>
&lt;h2 id="contributing-to-oss">Contributing to OSS
&lt;a class="heading-anchor" href="#contributing-to-oss" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;h3 id="getting-started-with-github">Getting started with GitHub
&lt;a class="heading-anchor" href="#getting-started-with-github" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;p>Starting is easy, and you have two doors. Open your own project, or contribute to one that already exists. A pet project fits the first door perfectly.&lt;/p>
&lt;h3 id="pet-projects">Pet projects
&lt;a class="heading-anchor" href="#pet-projects" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;p>A pet project is a playground to build real software and train real skills. Put it on your public GitHub profile and you get every benefit of contributing to OSS, plus one more: you answer to nobody. You set the roadmap. You decide what to build and how. You are your own boss.&lt;/p>
&lt;blockquote>
&lt;p>The project is there for you. You are responsible to play, explore, and push past your limits.&lt;/p>
&lt;/blockquote>
&lt;h3 id="my-pet-projects">My pet projects
&lt;a class="heading-anchor" href="#my-pet-projects" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;p>&lt;strong>Active:&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;a rel="external" href="https://github.com/Chemaclass/agnostic-ai">agnostic-ai&lt;/a>: write AI agents, skills, rules, and hooks once, use them in every AI CLI.&lt;/li>
&lt;li>&lt;a rel="external" href="https://github.com/Chemaclass/bashdep">bashdep&lt;/a>: a simple dependency manager for Bash.&lt;/li>
&lt;li>&lt;a rel="external" href="https://github.com/Chemaclass/phel-snake">phel-snake&lt;/a>: the snake game in your terminal, written in Phel.&lt;/li>
&lt;li>&lt;a rel="external" href="https://github.com/Chemaclass/EdifactParser">edifact-parser&lt;/a>: a parser for a UN/EDIFACT file format in PHP.&lt;/li>
&lt;li>&lt;a rel="external" href="https://github.com/Chemaclass/unspent">unspent&lt;/a>: a PHP library for UTXO-like bookkeeping with unspent entries.&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Inactive:&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;a rel="external" href="https://github.com/Chemaclass/create-pr">create-pr&lt;/a>: a Bash script to open a pull request from your branch and context.&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Abandoned:&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;a rel="external" href="https://github.com/Chemaclass/stock-ticker">stock-ticker&lt;/a>: get a notification with the news from your favorite Tickers.&lt;/li>
&lt;li>&lt;a rel="external" href="https://github.com/Chemaclass/JiraStatusNotifier">jira-status-notifier&lt;/a>: Notify when the JIRA tickets don’t move along.&lt;/li>
&lt;li>&lt;a rel="external" href="https://github.com/Chemaclass/php-best-practices">php-best-practices&lt;/a>: what I considered best practices for web-dev (archived).&lt;/li>
&lt;li>&lt;a rel="external" href="https://github.com/Chemaclass/php-scaffolding">php-scaffolding&lt;/a>: a basic PHP scaffolding with Docker (archived).&lt;/li>
&lt;li>&lt;a rel="external" href="https://github.com/Chemaclass/knob-mvc">knob-mvc&lt;/a>: a framework to create WordPress templates (2015/2017).&lt;/li>
&lt;/ul>
&lt;blockquote>
&lt;p>… and many more on &lt;a rel="external" href="https://github.com/Chemaclass">github.com/Chemaclass&lt;/a>&lt;/p>
&lt;/blockquote>
&lt;h3 id="my-oss-organization-contributions">My OSS organization contributions
&lt;a class="heading-anchor" href="#my-oss-organization-contributions" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;p>&lt;strong>Active:&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;a rel="external" href="https://github.com/phel-lang/phel-lang">phel-lang&lt;/a>: Phel is a functional programming language that compiles to PHP.
It is a dialect of Lisp inspired by Clojure and Janet. I already wrote a post about
this: &lt;a href="/blog/phel-first-release/">Phel: A Lisp that compiles to PHP&lt;/a>&lt;/li>
&lt;li>&lt;a rel="external" href="https://github.com/gacela-project/gacela">gacela-project&lt;/a>: Gacela is a PHP framework that helps you to improve the
design of your application by splitting the logic into different modules.&lt;/li>
&lt;/ul>
&lt;p>&lt;strong>Abandoned:&lt;/strong>&lt;/p>
&lt;ul>
&lt;li>&lt;a rel="external" href="https://github.com/NuevaMetal/nm_template">nm_template&lt;/a>: The base template for NuevaMetal (2013-2016).&lt;/li>
&lt;/ul>
&lt;h2 id="knowledge-sharing-and-impact">Knowledge Sharing and Impact
&lt;a class="heading-anchor" href="#knowledge-sharing-and-impact" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;p>Code is only half of it. The other half is what you write down and hand to the next person.&lt;/p>
&lt;h3 id="blog-posts">Blog posts
&lt;a class="heading-anchor" href="#blog-posts" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;ul>
&lt;li>&lt;a href="/blog/pull-request-vs-pair-prog/">Pull Requests vs Pair Programming&lt;/a>&lt;/li>
&lt;li>&lt;a href="/blog/the-process-itself-is-the-goal/">The Process Itself Is the Goal&lt;/a>&lt;/li>
&lt;li>&lt;a href="/blog/the-art-of-refactoring/">The Art of Refactoring: When, How, and Why&lt;/a>&lt;/li>
&lt;li>&lt;a href="/blog/the-art-of-testing/">The Art of Testing: Where Design Meets Quality&lt;/a>&lt;/li>
&lt;/ul>
&lt;blockquote>
&lt;p>… and many more on &lt;a rel="external" href="https://chemaclass.com/blog/">https://chemaclass.com/blog/&lt;/a>&lt;/p>
&lt;/blockquote>
&lt;h3 id="the-beauty-of-oss">The beauty of OSS
&lt;a class="heading-anchor" href="#the-beauty-of-oss" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;p>Contribute in public long enough and you start to see your own growth. The corrections you keep making. The code you wrote last year, already aged. The mistakes, all of them, in the open. And underneath, the slow proof that you are getting better.&lt;/p>
&lt;p>You build a sixth sense for patterns you have hit before, the good ones and the painful ones.&lt;/p>
&lt;p>&lt;strong>Show your skills. Help the people around you.&lt;/strong> That is &lt;a href="/blog/working-with-the-garage-door-open/">working with the garage door open&lt;/a>.&lt;/p>
&lt;blockquote>
&lt;p>Open-source software offers you one of the best opportunities to start building a career of continuous improvement.&lt;/p>
&lt;/blockquote>
&lt;hr />
&lt;p>This is a (Spanish) talk that I did remotely on April 2021,
for &lt;a rel="external" href="https://www.meetup.com/phpmad/events/277733306/">PHPMad Madrid Community&lt;/a>. I present all these ideas
together with a live demo of how to contribute to a real OSS.&lt;/p>
&lt;div style="position:relative;aspect-ratio:16/9;width:100%;">
&lt;iframe
src="https://www.youtube-nocookie.com/embed/GE5wR_SC_P4"
title="YouTube video"
width="560"
height="315"
loading="lazy"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
referrerpolicy="strict-origin-when-cross-origin"
style="position:absolute;inset:0;width:100%;height:100%;border:0;"
allowfullscreen>
&lt;/iframe>
&lt;/div>
&lt;hr /></content></entry><entry xml:lang="en"><title>Sharing Your Git Patches</title><subtitle>Another way of sharing quick suggestions with your team</subtitle><category term="git" scheme="https://chemaclass.com/tags/git/" label="Git"/><category term="code-review" scheme="https://chemaclass.com/tags/code-review/" label="Code Review"/><category term="communication" scheme="https://chemaclass.com/tags/communication/" label="Communication"/><category term="pair-programming" scheme="https://chemaclass.com/tags/pair-programming/" label="Pair Programming"/><published>2020-12-01T00:00:00+00:00</published><updated>2020-12-01T00:00:00+00:00</updated><author><name>
Chemaclass</name></author><link rel="alternate" type="text/html" href="https://chemaclass.com/blog/sharing-git-patches/"/><id>https://chemaclass.com/blog/sharing-git-patches/</id><summary type="html">Discover another way of sharing suggestions with your development team.</summary><content type="html">&lt;p>Discover another way of sharing suggestions with your development team.&lt;/p>
&lt;span id="continue-reading">&lt;/span>&lt;h3 id="imagine-this-situation">Imagine this situation
&lt;a class="heading-anchor" href="#imagine-this-situation" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;p>You are reviewing a &lt;a href="/blog/pull-request-vs-pair-prog/">Pull Request&lt;/a> (PR), and you see some minor improvements or suggestions that you would like to share with the author. You might write some comments, and usually, that would be sufficient.&lt;/p>
&lt;p>Imagine that in order to transmit your “whole idea” you would need to change some files because just communicating the full picture will end up in a huge comment which might be not as clear as it could be.&lt;/p>
&lt;h2 id="what-possibilities-are-there-apart-from-just-comments-in-a-pr">What possibilities are there apart from just comments in a PR?
&lt;a class="heading-anchor" href="#what-possibilities-are-there-apart-from-just-comments-in-a-pr" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;p>Well, there are multiple options. The key is to be aware of them and use them wisely depending on the priority of the task and the changes themselves:&lt;/p>
&lt;ul>
&lt;li>As already mentioned, writing a comment as &lt;a href="/blog/ship-show-ask/">feedback&lt;/a> is a good idea by default, but not the only one.&lt;/li>
&lt;li>We can always do some pair-thinking, talk at any time. Communication is always good in order to clarify the possible uncertainty.&lt;/li>
&lt;li>Sharing your git patches is another good option.&lt;/li>
&lt;/ul>
&lt;h2 id="git-diff-to-the-rescue">Git diff to the rescue!
&lt;a class="heading-anchor" href="#git-diff-to-the-rescue" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;p>What if you (as a reviewer) could share your idea without any single commit or comment in the PR, but sharing your changes directly with the author?&lt;/p>
&lt;p>Well, that’s actually possible and really easy. As you already know, the git diff command gives you the differences between any two branches.&lt;/p>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="shellscript">&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">git&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> diff&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> origin&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> develop&lt;/span>&lt;span style="color: light-dark(#D73A49, #F97583);"> &amp;gt;&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> ../my-origin-develop.patch&lt;/span>&lt;/span>&lt;/code>&lt;/pre>
&lt;p>What we are doing here is redirecting the output of the diff command into a file (aka: patch), so we can share that output with any other peer-team.&lt;/p>
&lt;h2 id="what-now">What now?
&lt;a class="heading-anchor" href="#what-now" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;p>Well, having that patch file, it’s pretty easy to apply those changes in your local machine without doing any commit:&lt;/p>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="shellscript">&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">git&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> apply&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> ../my-origin-develop.patch&lt;/span>&lt;/span>&lt;/code>&lt;/pre>
&lt;p>Applying this patch will simply change your local system in the same way the patch was created.&lt;/p>
&lt;h2 id="how-to-by-steps">“How to” by steps
&lt;a class="heading-anchor" href="#how-to-by-steps" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h2>
&lt;p>Let’s divide the responsibilities into two: the creator of the patch and its user:&lt;/p>
&lt;h3 id="the-patch-creator-the-person-who-will-create-the-patch">The patch creator: the person who will create the patch
&lt;a class="heading-anchor" href="#the-patch-creator-the-person-who-will-create-the-patch" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="shellscript">&lt;span class="giallo-l">&lt;span style="color: light-dark(#6A737D, #6A737D);">#&lt;/span>&lt;span style="color: light-dark(#6A737D, #6A737D);"> Checkout that branch&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">$&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> ~/myProject&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> git:&lt;/span>&lt;span>(&lt;/span>&lt;span style="color: light-dark(#6F42C1, #B392F0);">the-branch&lt;/span>&lt;span>)&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> ➜&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> git&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> pull&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> origin&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> the-branch&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span style="color: light-dark(#6A737D, #6A737D);">#&lt;/span>&lt;span style="color: light-dark(#6A737D, #6A737D);"> Do your suggestions and changes in the targeted branch&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span style="color: light-dark(#6A737D, #6A737D);">#&lt;/span>&lt;span style="color: light-dark(#6A737D, #6A737D);"> Generate the patch file using the diff command&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">$&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> ~/myProject&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> git:&lt;/span>&lt;span>(&lt;/span>&lt;span style="color: light-dark(#6F42C1, #B392F0);">the-branch&lt;/span>&lt;span>)&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> ➜&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> git&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> diff&lt;/span>&lt;span style="color: light-dark(#D73A49, #F97583);"> &amp;gt;&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> ../your-diff.patch&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span style="color: light-dark(#6A737D, #6A737D);">#&lt;/span>&lt;span style="color: light-dark(#6A737D, #6A737D);"> Share the patch file with the author of the PR&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;h3 id="the-patch-user-the-person-who-will-see-the-patch">The patch user: the person who will see the patch
&lt;a class="heading-anchor" href="#the-patch-user-the-person-who-will-see-the-patch" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h3>
&lt;pre class="giallo" style="color-scheme: light dark; color: light-dark(#24292E, #E1E4E8); background-color: light-dark(#FFFFFF, #24292E);">&lt;code data-lang="shellscript">&lt;span class="giallo-l">&lt;span style="color: light-dark(#6A737D, #6A737D);">#&lt;/span>&lt;span style="color: light-dark(#6A737D, #6A737D);"> Ensure you are in that branch&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">$&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> ~/myProject&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> git:&lt;/span>&lt;span>(&lt;/span>&lt;span style="color: light-dark(#6F42C1, #B392F0);">the-branch&lt;/span>&lt;span>)&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> ➜&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> git&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> pull&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> origin&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> the-branch&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span style="color: light-dark(#6A737D, #6A737D);">#&lt;/span>&lt;span style="color: light-dark(#6A737D, #6A737D);"> Apply the patch file&lt;/span>&lt;/span>
&lt;span class="giallo-l">&lt;span style="color: light-dark(#6F42C1, #B392F0);">$&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> ~/myProject&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> git:&lt;/span>&lt;span>(&lt;/span>&lt;span style="color: light-dark(#6F42C1, #B392F0);">the-branch&lt;/span>&lt;span>)&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> ➜&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> git&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> apply&lt;/span>&lt;span style="color: light-dark(#032F62, #9ECBFF);"> ../your-diff.patch&lt;/span>&lt;/span>&lt;/code>&lt;/pre>
&lt;hr />
&lt;h4 id="references">References
&lt;a class="heading-anchor" href="#references" title="Copy link" aria-label="Link to this section">#&lt;/a>
&lt;/h4>
&lt;ul>
&lt;li>&lt;a rel="external" href="https://git-scm.com/docs/git-apply">Official documentation for “git apply”&lt;/a>&lt;/li>
&lt;/ul></content></entry></feed>